Scene Loader problem

After loading Scene Loader into the Start Button, when I go to click “No Function” and scroll down the arrow button for Scene Loader, there is no option there for “LoadNextScene.” For some reason, it is not listed the list like it should be and I am getting the following arrow:

Here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagment;

public class SceneLoader : MonoBehaviour {

	public void LoadNextScene()
    {
        int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
        SceneManager.LoadScene(currentSceneIndex + 1);
    }
}

Hi Penny,

If you look at the bottom of the Unity window you’ll notice you have an error message. The error will be preventing your scripts from compiling, as such, your new method won’t exist - to Unity.

The issue itself is due to a typo in your using directive at the top of your SceneLoader.cs script. If you look carefully you’ll see that you’ve missed an “e” out of “SceneManagement”, it should read;

using UnityEngine.SceneManagement;

Thanks for applying the code formatting by the way, unfortunately you used the wrong character, I’ve corrected it in your post for you, it’s the ` character you need to use, three of them before and after the code block.

Hope this helps :slight_smile:


See also;

Thanks so much! I can’t believe I missed that “e”. I looked it over and over again and just didn’t see any errors. It sure helps having someone else look it over.

I had a feeling I was using the wrong character for the code formatting. Thanks for letting me know.

1 Like

You’re very welcome Penny, glad you can move forward again :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms