x


Function triggered when scene changes?

Is there a function or MonoBehaviour in Unity which is triggered before a scene changes in the scene that is being changed from? (such as when Application.LoadLevel() is called) Something like the opposite of the Awake() function?

Thank You!

more ▼

asked Aug 02 '10 at 08:38 PM

BinaryCaveman gravatar image

BinaryCaveman
792 6 10 22

hey you commented on mine so...

well I got the gun to show but now I need it to move with the camera. Also I kinda need crosshair help.

Nov 12 '10 at 06:34 AM John 20
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

There is an OnLevelWasLoaded(int : level) function, which should do exactly what you want

more ▼

answered Aug 02 '10 at 08:47 PM

Mike 3 gravatar image

Mike 3
30.5k 10 65 253

Sorry - I should rephrase my question. I want to know of a function that is called before a scene changes, in the scene the user is changing from.

Aug 02 '10 at 08:49 PM BinaryCaveman

Then no, there isn't one. You'll get an OnDisabled, but that's about it - The problem is that it's fired when you disable the script too (or make the gameobject inactive)

Aug 02 '10 at 08:51 PM Mike 3

OK, then. Thank You!

Aug 02 '10 at 08:51 PM BinaryCaveman
(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:

x717
x478
x133
x13

asked: Aug 02 '10 at 08:38 PM

Seen: 1381 times

Last Updated: Aug 02 '10 at 08:50 PM