- Home /
AsyncOperation.progress, I'm missing something here...
I was following a tutorial along, and using it as a guide to write a JS version.
The level loads, as expected...but the AsyncOperation.progress command doesn't move off of 0 in the while statement.
function LoadLevel ()
{
var async : AsyncOperation = Application.LoadLevelAsync(levelToLoad);
nguiPanel.SetActive(true);
while ( !async.isDone )
{
silder.sliderValue = async.progress;
print (async.progress);
yield;
}
}
I'm aware that it's a float value from 0 - 1 so I'm expecting the print command to give me a progression from 0 - 1 as the level loads. But instead I only get 18-20 print lines of "0"?
Why isn't this value moving?
Answer by Rick74 · May 22, 2014 at 12:06 AM
Well, unless someone has a magical theory as to why this doesn't work...I did some digging and found out that this wasn't fixed until February this year.
I am currently working in 4.2.1f...in that version of Unity, .progress is broken.
Fired this project up in the latest version of Unity and it works fine. (although the print statement still returns 0's...the progress bar is moving accordingly)
So there it is, for anyone who's curious.