0

I have a module in Unity Project that has DontDestroyOnLoad in its Start().

How can I write a func (of which of the existing ones is there) that would run every time a new scene is loaded?

I've tried both Start() and OnEnable() and it didn't seem to work?

1
  • It sounds like you may need to separate the responsbilities into 2 different scripts. One that runs every time the scene is loaded, and the other that contains the persisted responsibilities. Commented Oct 16, 2019 at 16:28

1 Answer 1

1

Unity's SceneManager has a notification to which you can add a delegate function to run when a scene is loaded.

You can find an example on how to use it in Unity's documentation: SceneManager.sceneLoaded delegate

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.