Hi;
I am developing an streamed web application with unity for Windows.
I have a strange problem. When i want to load a new level i first check how much of the level is loaded with Application.GetStreamProgressForLevel. Problem is if the level is not loaded and if i call GetStreamProgressForLevel it only responds once. After that GetStreamProgressForLevel always gives me the same value and i cannot use other Application object properties like Application.LoadLevel.
Here is a piece of code :
public var counter : int = 0;
public var LoadedBytes : float = 0.0;
function OnGUI ()
{
if( LoadedBytes == 0 )
{
LoadedBytes = Application.GetStreamProgressForLevel(2) ;
}
counter++;
if( counter >= 500 )
{
if( LoadedBytes == Application.GetStreamProgressForLevel( 2 ) )
{
Application.LoadLevel( 2 );
}
else
{
counter = 0;
LoadedBytes = Application.GetStreamProgressForLevel( 2 );
}
}
}
Here in this code i tried to break the lockdown in the program. I count till with the counter and then when counter equals to 500 i check if the Application.GetStreamProgressForLevel is changed. And even though the GetStreamProgressForLevel returns me the same value and even though it enters
if( LoadedBytes == Application.GetStreamProgressForLevel( 2 ) )
{
Application.LoadLevel( 2 );
}
part ( i know it enters that if cause i put a label control in the if and i see that it creates that label on the screen ) it doesn’t load that level.
It’s also strange that Application object locks down and Application.GetStreamProgressForLevel method always returns me the same value. But if the 100% percent of the level is loaded then i don’t have any problems with loading it.
I think this is an unity bug. And if so does anybody else encounters the same problem?
I hope i could make myself clear. If there is any confusion about the subject i can give an even more detailed explanation. Solving this problem is really important for me as it effects the loading of different levels.
Any ideas or suggestions are welcome. Thanks.