Okay I have another question to ask, and this is when the player approaches a part in the level for a section of it to load.
I want to keep all of it together in one whole level so i dont have to keep creating a seperate biuld, to just make it so that when the game starts, keep the "begining section" of the level first, but everything else will be gone till you reach like a checkpoint, or in this case a triggered gameobject, to delete "the begining section" and create "middle Section" to keep the player from lag and delay, while playing the game.
And I want to keep doing this through out the rest of the entire game. I would Love to know the script as i am a scripting noob, i will admit but not affraid to ask.
Check out our site!
asked Mar 03 '10 at 06:31 PM
On the other hand, you might not asking about streaming, so much as making areas visible as a player activates various triggers. Which is actually how I first interpreted the question, until I saw the bit about lag. If that's the case, what you can do is:
Make an empty GameObject (GO) for each zone you want, and name them (example, I'll call one Level_9). Move the objects to be in that zone, under the GO as children. Disable Level_9 in the Editor - it's the checkbox near the name in the Inspector. When it asked, you also want to disable all the children. They should no longer be visible when the level starts.
The second part, enabling them is a bit more tricky. You need a script on each triggering item, that will re-enable a specific GO and all its children. The script would be attached to some object (call one, say, Portal_9), which would set to fire on mouse-click or collider proximity. The script would have a public GameObject variable, which you set to Level_9. That gives the script a reference to the GO.
Here is a question/answer on writing a script to trigger based on object proximity:
Then, when the script fires, it has to enable Level_9 and all its children. Here is another answer which talks about how to enable a GO + children:
And yes, it's going to be a fair bit of programming - welcome to Unity. :)
There's two possible answers, depending on what you're trying to do. If you're just trying to keep the player from staring at a long loading bar, then you can do something like this:
With this method, everything in the scene will be loaded (eventually), but it shouldn't slow down the player.