x


how to spawn and destroy

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.

Thank you.

Check out our site!

www.delvegame.webs.com

more ▼

asked Mar 03 '10 at 06:31 PM

Trevor 1 gravatar image

Trevor 1
45 10 11 17

Are you looking for a solution like the "streaming sub-levels" on Unreal Engine? I have no idea how, but there are some new keywords for you, if that's it. ;)

Mar 05 '10 at 06:18 PM Cawas
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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:
Triggering a GUI based on 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:
Enable/disable a complex GameObject?

And yes, it's going to be a fair bit of programming - welcome to Unity. :)

more ▼

answered Mar 10 '10 at 09:40 PM

Cyclops gravatar image

Cyclops
7.1k 33 63 115

(comments are locked)
10|3000 characters needed characters left

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:

make the first scene a really small loader scene that does a progress bar, and use a streaming web player. That way your progress bar will come up fast (even on dial-up) and you can do whatever you want in Unity to make it nifty. Well, within reason...the point is to keep the first scene really small. :)

To quote Eric5h5 from: Web Player Loading Screen
For more information, see the manual at Web Player Streaming

With this method, everything in the scene will be loaded (eventually), but it shouldn't slow down the player.

more ▼

answered Mar 10 '10 at 09:37 PM

Cyclops gravatar image

Cyclops
7.1k 33 63 115

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5087
x806
x764
x184

asked: Mar 03 '10 at 06:31 PM

Seen: 2421 times

Last Updated: Mar 03 '10 at 06:31 PM