[SOLVED] How to make Cross-scene scripts?

Hey!
I just found this

small (4min) tutorial on scene management. However, when I try to follow it, the script isn’t “carried over” when I change scene… And I therefore end up with the ability to go to either scene 1 or 2 when I start, but I can’t go from 1 to 2 or the other way around.

So basicly I’m not sure how I make cross-scene scripts?

And you copied the script exactly? If you have the DontDestroyOnLoad part, the gameobject with the script will carry over.

It might be helpful to know what you are trying to do, as that would help us provide solutions as you might not need a script that carries over.

I was just trying to follow the video, nothing specific I wanted to achieve. - I was wondering that since the video wasn’t the newest, that something might had changed, however you were very right that I didn’t copy it exactly, as soon as I called Awake (Which I guess is an override of a parent method?) it worked as expected.

Thanks. :slight_smile:

You don’t have to call Awake. It is called automatically by Unity. https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html

But you need to make sure it’s “Awake” and not “awake”.

Also important that the GameObject is active.