x


how to access objects in another scene but in the same project?

i wanna know how to get it that when i collide with the end of level object another level becomes available. i have the collision part but obviously my level select screen is a different scene, so when i collide with the end of level object the trigger object for the next level becomes active. could someone help me with this issue? All help is appreciated. Thanks!

more ▼

asked Aug 24 '10 at 09:17 PM

john 2 gravatar image

john 2
75 29 35 46

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

2 answers: sort voted first

You can use PlayerPrefs to save level unlocks.

e.g.

PlayerPrefs.SetInt("Level2Unlocked",1);

To check if a level is unlocked you go like so:

if(PlayerPrefs.HasKey("Level2Unlocked")){
  Application.LoadLevel(2);
}

Check out the docs for other data types you can save in player prefs

more ▼

answered Aug 24 '10 at 09:33 PM

spinaljack gravatar image

spinaljack
9.1k 18 31 91

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

You would use Application.LoadLevel or Application.LoadLevelAdditive or Application.LoadLevelAsync or Application.LoadLevelAdditiveAsync to load scenes. See Application for more details.

To preserve data between scenes, you would want to use DontDestroyOnLoad or like spinalJack said, use player prefs.

Please see the latter portion of the 3D Platformer Tutorial for example usage.

more ▼

answered Aug 24 '10 at 09:35 PM

skovacs1 gravatar image

skovacs1
10k 11 25 91

(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:

x5088
x3462
x718
x322
x5

asked: Aug 24 '10 at 09:17 PM

Seen: 1849 times

Last Updated: Aug 24 '10 at 09:17 PM