Hey guys, I have no problem in loading levels but my problem is when the LoadLevel complete, it just jump into the level loaded, what I really want is make it load in background, but don’t switch to it automatically, keep invisible until I tell it to switch to that leval.
While Ian is correct that what you are trying to do is easier in Pro, there is a way to do it in Free, though it wont be pretty. And will likely look like crap/lag. And will also require more micro on your part.
If it is brutally needed for your game, and you do not have Pro, you can use LoadLevelAdditive. You will not enjoy this, and it wont be over quickly.
Basicallythis technique requires that you make a scene a child of a single GameObject. The Whole scene. When you initially load the level, it should be placed out of the way (like under the map or really high in the sky, just keep it out of the camera frustrum.
Make sure you deactivate recursively that main GameObject when you start so enemies dont start up and what not. Then when you need to switch, activate the object recursively, and move it to a predetermined location (like 0,0,0), and destroy the game Object that was the root of the previous level.
Note that this means you have to save objects that you want to keep between scenes(IE the player, yourself. Anything that is underneath the root node needs to be detached (transform.parent = null) before you actually kill the level.
Again this will give you the result, but at a terrible cost in game time and headaches.
If there is no other way, fine, but please consider just loading the level when you need it.
Alright, personally, I really hope you went with the camera fading suggestion, but I was thinking about it and there might be a way to get what you want, loading a level over time, with minimal impact to to performance, and even being able to use a progress bar.
Let me state up front I do not recommend this in any way shape or form, and anyone reading this is advised to stop. My recommendation is a fade out and in. Minimal headache to Maximum good look ratio.
I have never done this, but it should work. If you have a complete level, you could technically break it up into small pieces and save them as a huge set of prefabs. I would recommend the use of prefab utility to make a editor window or something to do this, but whatever. Keep all of the prefabs to a level in a Resources Folder, or as references in an object.
When you want to load the level. Load one prefab at a time using a coroutine to drag it out over a few seconds, updating a progress bar if you need between prefab instantiations.
I think this would work.
Again I highly recommend just fading the camera.
Side Note: I feel like a police negotiator:“Just put down the gun, no need to instantiate everything, Billy!”
Also, if you try this <.< … >.> … let me know if it works. I would never use this, but I am kind of curious.