In this example, the slider (UI) value is set in the main thread. And the value it is taken is updated by the import asynchronous thread. So no UI directly updated in an asynchronous thread!
In this example, the slider (UI) value is set in the main thread. And the value it is taken is updated by the import asynchronous thread. So no UI directly updated in an asynchronous thread!
C
Carsten Schonart
said
over 1 year ago
Ok, I see, this works - thank you.
As it seems , the onProgressChanged method is only called at fixed precentage values, like 40, 60, 80, 90%.
Any way to get true percentage integers like 0,1,2,3,...., 100?
Nicolas Marcadet
said
over 1 year ago
Unfortunately, this progress value is not as precised as we would like it to be. So we only return the important steps of the process.
If you want to get a more linear progress bar, I suggest you do something like this:
Carsten Schonart
While importing asynchronously I´d like to have a progressbar.
So I added this line of code into the provided onProgressChanged method:
Because of asynchronously importing I get an UnityException:
get_isPlaying can only be called from the main thread.
What can I do?
For example, like this:
In this example, the slider (UI) value is set in the main thread. And the value it is taken is updated by the import asynchronous thread. So no UI directly updated in an asynchronous thread!- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstNicolas Marcadet
Hi Carsten!
Thanks for contacting us!
This is because you cannot make UI modifications on an other thread than the main one in Unity.
You should look into passing this information to the main thread and then update your UI.
Best,
Nicolas
Carsten Schonart
Nicolas Marcadet
For example, like this:
In this example, the slider (UI) value is set in the main thread. And the value it is taken is updated by the import asynchronous thread. So no UI directly updated in an asynchronous thread!Carsten Schonart
Ok, I see, this works - thank you.
As it seems , the onProgressChanged method is only called at fixed precentage values, like 40, 60, 80, 90%.
Any way to get true percentage integers like 0,1,2,3,...., 100?
Nicolas Marcadet
Unfortunately, this progress value is not as precised as we would like it to be. So we only return the important steps of the process.
If you want to get a more linear progress bar, I suggest you do something like this:
1 person likes this
Carsten Schonart
Thank you!