Unity Bug / Application Object Crashes - Web Streaming

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.

A) Does this occur on all machines/browsers/OSes or only one/some?

B) Does this occur in any other projects or only this one?

C) Do you know that it’s truly downloaded the entire next level and that Application is “locked down”? Might it just be a network hang or something?

Sorry but I don’t know of this as a general issue so all I’m left with are general questions. :frowning:

Hi;

Thanks for the quick reply. Here are the answers :slight_smile:

a) i’ve tried this on Vista/XP/MacOS systems. And i had the same problem.

b) Didn’t try this on any other project. Just this one.

c) No it can’t be a network hang. I have this problem everytime i try it. I see the counter counting up on the screen. And i see that application enters this if;

if( LoadedBytes == Application.GetStreamProgressForLevel( 2 ) ) 
      { 
          Application.LoadLevel( 2 ); 
      }

when i put a label into that if that label is showing up on the screen. So that means it’s hitting the Application.LoadLevel( 2 ); part. But it just doesn’t load the next level :frowning:

Well i’ll keep you updated if i can find a solution or the cause of this error.

Cheers.