After switching from scene 0 to 1, my button freezed. No onClick event is fired

I build the script and button like in lecture 38. No problem of switching from Start Scene to Core Scene.
After lecture 39 is done in Core Scene the highlight effect of the button dissapear and click on button doesn’t trigger the ClickEvent. Start the Core Scene first have the same problem. What mistake am I making? Unity-Version: 2019.3.6f1

components of button in the Core Scene:

herachie:
herachie

SceneLoader(Object):
sceneLoader

SceneLoader(Script):

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

public class SceneLoader : MonoBehaviour
{
    public void LoadNextScene()
    {
        Debug.Log("CLICK");
        int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
        Debug.Log("currentSceneIndex: " + currentSceneIndex);
        SceneManager.LoadScene(currentSceneIndex + 1);
    }

    public void LoadStartScene()
    {
        SceneManager.LoadScene(0);
    }
}

No “CLICK” in debug-console

Hi Leon,

Please run your game and go from the Start scene to the Core scene. Once the Button stops working, pause your game and check the Inspector again. Does the OnClick field still contain a reference to the SceneLoader object?

Hi Nina!

Thank you for the advice. I was blind. Look on the herachie image. I didn’t add the EventSystem…
Adding the EventSystem resolve the problem.

best regards

Leon The Blind

1 Like

Now that you are mentioning it, it’s pretty obvious. Well spotted!

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

Privacy & Terms