Update modelview from another thread (Unity3D)
Posted: 30 Jun 2016, 18:18
Hi all,
I've got a seperate thread for loading data from an USB stick. This thread should update the user interface with the current filename.
This crashes the Unity Editor (and the standalone application) almost immediately.
In the modelview:
From within the thread:
Did I make a mistake or is this just not possible - or not the right way..?
I've got a seperate thread for loading data from an USB stick. This thread should update the user interface with the current filename.
This crashes the Unity Editor (and the standalone application) almost immediately.
In the modelview:
Code: Select all
private object _LockObject = new object();
protected string _progressString;
public string progressString
{
get {
lock (_LockObject) {
return _progressString;
}
}
set {
lock (_LockObject) {
_progressString = value;
NotifyPropertyChanged ("progressString");
}
}
}
Code: Select all
_mainWindow.progressString = filename;