Problems with Stream Progress?

Hey folks,

My Unity project has 13 different levels. The first level is basically just GUI elements and after it finishes loading it automatically triggers the loading of the second level (which is about 5MB).

I’ve got a loading bar set up using Application.GetStreamProgressForLevel. This loading bar is displayed when the second level starts loading.

It seems to work properly when the second level is loading (starts at 0% and progresses to 100%). After each level is loaded the next level should automatically start loading. The load bar for these subsequent levels never starts at 0% (usually it starts at around 70% and goes to 100%).

Is there some sort of shared information between levels that could cause Application.GetStreamProgressLevel to return .7 as the first value when the subsequent levels begin loading?

Ideally this streaming would only stream from one level at a time (so that the level that is currently streaming would appear more quickly).

Thanks,
Jared

I think I’m confused on how the streamed web players work in general.

I set up a function to display the progress of each level in my project (as soon as the initial level is loaded). It seems that all of the levels after the initial level start streaming at the same time (not one after the other). So, after level 2 finishes loading I expected to see:

level 2 progress: 1
level 3 progress: 0
level 4 progress: 0

Instead, I see something like:

level 2 progress: 1
level 3 progress: .8
level 4 progress: .75

Is there any way to change how the streaming is behaving? I’d really like to load all of level 2 before level 3 starts loading (similarly for subsequent levels, all of 3 before 4 et cetera).

I checked out the documentation at:

http://unity3d.com/support/documentation/Manual/Web%20Player%20Streaming.html

It says this form of streaming is linear (and I suppose in a way it is because level 2 always finishes loading before level 3), but if it were truly linear shouldn’t it load all of level 2 before starting to load level 3?

I guess I can write something to fake the load progress bars so that they always start at 0; what concerns me most is getting level 2 to load as fast as possible. I’m probably wrong, but it seems like it can’t currently be loading level 2 as fast as possible because the download of the later levels is also progressing.

Thanks,
Jared

FYI: It looks like the end of a sentence might be missing in the documentation page I linked to. The last sentence in the second paragraph under Publishing Streaming Web Players reads "When you look at the Console during/after a build, you can see how large ".

Not needfully
Many webhost restrict the bandwidth per connection, so if you only have 1 level streaming in instead of 2 you might actually as well end in the situation where you only use half your bandwidth for example.

It makes sense therefor that other stuff is downloaded in the background.

I thought would agree that it would put the main bandwidth on the next level of interest (I guess this would needed to be controllable throught scripts for games that don’t have a linear level order) and only spends the remaining bandwidth on the others.

Levels are in fact laid out and streamed completely linearly. Since there is sharing of assets going on, some of the data will already be available to later levels.

Thanks for the responses.

As far as I’m aware, the levels aren’t sharing any assets.

I’ve got an initial level with some GUI buttons, a camera, a light and some scripts. Each subsequent level loaded is a distinct set of models (these are loaded without destroying anything from the previously loaded levels). These levels only consist of models… there don’t appear to be any lights or cameras or scripts or anything else.

Is there something else they could be sharing that I’m not aware of? Is it sharing assets that are available in the library but not actually used in the current level?

Thanks again,
Jared

I’m still having some trouble understanding what is happening with the streaming web player.

I took my project and I removed all levels after level 2. I then tested the time it took to load level 2 in this new project versus the time it took to load level 2 in the old project (which had 10 other levels each with a stream percentage that was increasing as level 2 loaded).

I found no noticeable difference in the time it took for level 2 to complete loading. I guess this makes sense given that the load is supposed to be linear.

The bit I’m still confused about it is why the stream progress of the levels after level 2 increases when only level 2 is loading. I would understand if there were assets shared between the levels, but all of these levels are distinct sets of models and nothing else.

Is there something that Unity is sharing between the levels that wouldn’t be found in the Assets folder?

If I want to have progress bars for loading each level and I want only the currently loading level’s bar to show up, do I have to fake it out to get the bar to start at 0 and go to 100? Right now the subsequent levels start at somewhere between 50% and 80% instead of at 0.

If I displayed the loading progress bars for each level right from the start they would all start at 0, but they would also all be increasing at the same time (giving the appearance of not being linear).

Thanks again,
Jared

Hey folks,

I thought I should update this thread a bit.

I experimented with changing the order of my levels and it seemed like no matter what position a level had in my load order it always took the same time to load. So, for instance I took my last level and loaded it first so that Application.GetStreamProgressForLevel would go from 0 to 1; the time it took for the level to load was equivalent to when I was loading this level last and Application.GetStreamProgressForLevel progresses from .9 to 1. With these results I decided that the levels were loading linearly and I just tweaked my load progress bars to more accurately represent the amount of each level loaded.

-Jared