SceneManager.sceneLoaded does not exist.

I can use SceneManager.sceneLoaded, or any of the events listed in the documentation, to check for scene changes.

yes, I am using UnityEngine.SceneManagement. The SceneManager itself is recognized. I assume maybe they're instance events, but I can't get the instance itself.

This compiles for me:

using UnityEngine;
using UnityEngine.SceneManagement;

public class Foo {
    void Bar() {
        SceneManager.sceneLoaded += (scene, mode) => Debug.Log("loaded scene " + scene + ", mode: " + mode);

If it doesn't for you, what version of Unity are you on? The SceneManager stuff is pretty new - 5.3 or 5.4, though I could be wrong.

Yeah that doesn't do it for me. Both Visual studio and Unity complain.

I'm on Unity version 5.3.5, though this project has had to be updated through several unity versions.

The Error is: error CS0117: UnityEngine.SceneManagement.SceneManager' does not contain a definition forsceneLoaded'

I probably have the wrong definition/declaration files somewhere. Maybe they didn't get updated.

Turns out it was introduced in 5.4. Here's the scripting reference for 5.3's SceneManager. You can always open the correct version of the docs from within Unity though the help menu.

1 Like

Oh thanks. Thought it was just going to be one of those quirky things.