Hi, I have a scene that takes up to 30 seconds to load on weaker android devices (around 1ghz cpu). Iam trying to find a way to either shorten that time or make it to preload the files.
Ive already searched for quite some time and tried some stuff (somehow I even managed to launch 2 scenes at the same time). The only thing that seemed to come close was a script that would load the scene while the first scene was running but it didnt wait for user to launch it, it just started the moment it was loaded. Does anyone know if I can make it to wait for the user to launch the scene?
1 Answer
1Presumably you were using LoadLevelAsync?
var loader = Application.LoadLevelAsync("somelevel");
loader.allowSceneActivation = false;
//When ready
loader.allowSceneActivation = true;
See this: http://docs.unity3d.com/Documentation/ScriptReference/AsyncOperation-allowSceneActivation.html
Iam sorry but Iam not familiar with that type of variable, so I really dont know how to use it. Am I supposed to somehow execute that variable? I have no idea how to do that.
– RGII'm a bit confused as I've given you all of the code you need. Load the level like I show, then when you want to activate it set loader.allowSceneActivation = true;
– whydoidoitSeems like the original scene now has the same size as the "game1". Could it be I somehow overwritten that scene?
– RGIafter some testing it seems like what your script does is that it replaces current scene with the scene named in the script. I made a new scene, putted the script in there and did the same thing, replaced that scene with "game1".
– RGIThe script activates the level when you set allowSceneActivation = true - it preloads the level, as you requested, and then activates it when you are ready. I'm totally lost as to how it manages to overwrite something - do you have that script executing in edit mode?
– whydoidoit