- Home /
Scene Streaming(Bethesda Style, not an internet question)
In the Unreal Engine, there is a concept known as level streaming, where you enter a volume, and the scene behind you is unloaded, and the scene in front of you loads, creating a seamless transition from one level to the next. Examples of this on a small scale would be like Bioshock or Mass Effect, where the former used an underwater walkway that went between massive structures, and the latter used elevators, much to the players' chagrin. Bethesda uses a similar method, but not as obvious, using tons of LoDs, and each chunk streams(essentially) the 8 chunks around it, having Radiant run in the background for NPC logic.
I'm looking to do something similar, and while I have the concept figured out in UDK, I much prefer Unity for scripting, and I was wondering where I should look in the documentation for a similar concept. Every time I search for Level Streaming, I get results for the web player, and talking about internet streaming, but I can't think of better words for it. Perhaps dynamic scene loading? Has anyone tried and/or implemented such a system? Or can anyone think of a good way to fake it?
Not looking for code or for someone to do it for me, more just a hint at where to look or the right questions to ask. Thanks!
Have you read the script reference? LoadLevelAdditivelyAsync is specifically made for doing exactly this. I recommend that you familiarise yourself with the capabilities of all the classes in the UnityEngine namespace- even if all you know are the names and paramaters of all the functions, that's still enough to work out how to do all but the most complex of scripting tasks (which this is not, really).
Thank you very much. As stated, I was stuck in ue3, and couldn't figure out the word I was looking for. Also good advice generally. I'll take that to heart.
Ah. This is a pro only feature. Should have guessed. I'm going to go out on a limb and assume there's no similar functionality in the indie version?
Answer by Bunny83 · Apr 29, 2012 at 11:13 AM
Like @syclamoth said Application.LoadLevelAdditiveAsync is exactly what you want but like you already figured out it's a pro-only feature. In the free version you can use Application.LoadLevelAdditive, but it's not that "seemless" since it will block until it's loaded.
I wouldn't say that it isn't possible in the free version. You might want to use you own scene format (some kind of xml scene). You have to find your own way to load (stream) all kind of assets (mesh, texture, material, gameobjects). It's still probably not as seemless as with LoadLevelAdditiveAsync but it should work. Note that some things can't be created / accessed from scripting but just a few (for example only ParticleEmitter is exposed to scripting but not the EllipsoidParticleEmitter so it can't be created via code). A workaround is to create some simple prefabs which can be instantiated.
I haven't done this before, but you should do some testing before you decide to go along with a specific method.
Thanks. So what's the primary difference between doing it asynchronously and not? Or in other words, how is it less seamless?
The asynchronous functions do the actual loading in the background in a seperate thread. This allows you to continue playing while the scene is loading. There is no interruption in the gameplay.
The simple LoadLevelAdditive function will interrupt the gameplay since it loads the scene in the current thread. It will block until the loading is finished.
If you have a strong pc and your "scene parts" are small you might not even notice the hiccup, but on iOS you will notice it since loading and destroying are quite heavy on mobile devices.
Your answer
Follow this Question
Related Questions
LoadLevelAsync hiccups on scene switch 0 Answers
Load and run scene in background 1 Answer
Resources.load vs LoadLevelAdditive which is faster 1 Answer
LoadSceneAsync breaks lighting with Assertion failed (Update: Light probes are to blame!) 0 Answers
RenderSettings not overwritten when using LoadLevelAdditive 0 Answers