Why doesn't my scene loader function appear?

image

This is the script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class SceneLoader : MonoBehaviour {

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

Hi @_silent, welcome to the community :slight_smile:

This behaviour typically occurs when you have created the reference by dragging the script, from the Assets folders, into the Object field, instead of the GameObject from the Hierarchy which has the script attached as a component.

1 Like

It worked, thank you.

1 Like

You’re very welcome :slight_smile:

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

Privacy & Terms