Start function when "new scene is loaded"


I need to know how to start a function ONLY when a new scene is loaded.

The reason is that, I need my "OverControl" that is an object that keep track of the game and never get destroyed, to find the "LevelControl" of the level, when a new scene is loaded.

Thank You,


Since people seem to have problems to understand the documentation of the new SceneManager, here’s an example:

// C#
void Start()
    SceneManager.sceneLoaded += OnSceneLoaded;

private void OnSceneLoaded(Scene aScene, LoadSceneMode aMode)
    // do whatever you like

Loads the level by its name or index.
Before you can load a level you have to add it to the list of levels used in the game. Use File->Build Settings… in Unity and add the levels you need to the level list there.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {