x


Effect object in another scene

I have a platformer type game being developed, I have it so that when you collect 50 items in any given level it will trigger a level complete sound. I also have a level select scene. What I need is that upon the collection of 50 objects the sound plays and the mesh render of an object in the level select scene is activated. Is this possible?

more ▼

asked Mar 04 '11 at 04:32 PM

RAWTalent gravatar image

RAWTalent
53 11 11 19

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

1 answer: sort voted first

There are a few ways to do this, I would recommend using a GameObject with a script that holds your unlock data that does not get destroyed on Scene Loading and Unloading. Your level reports to this GameObject about the number of stars collected and other variables of import, and then your Main Menu retrieves the data from this GO when it is setting itself up when you come back in.

The way I did it in my game is that I have a "Base Scene" this is where all of my persistent objects live, and when I load in a level, I first destroy all the objects in the old level (via tags) and then LoadLevelAdditive (http://unity3d.com/support/documentation/ScriptReference/Application.LoadLevelAdditive.html) the new scene.

You can also use this: http://unity3d.com/support/documentation/ScriptReference/Object.DontDestroyOnLoad.html To make sure your data holder doesn't get destroyed when you load in a scene.

more ▼

answered Mar 04 '11 at 04:47 PM

Thom Denick gravatar image

Thom Denick
1.9k 13 20 38

Much appreciated, sounds like it'll do th trick :)

Mar 04 '11 at 04:58 PM RAWTalent
(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:

x1095
x719
x201
x57
x21

asked: Mar 04 '11 at 04:32 PM

Seen: 1121 times

Last Updated: Mar 04 '11 at 04:32 PM