Start Button is Missing it's On Click() GameObject (and Script, and Method)

My Start Menu scene Start Button is missing Level (Level) under On Click (), when I go to it from the Game Over scene, and so the Start Button doesn’t work then, but it is there when I load the scene directly from Unity.

DETAILS:
If I load the Start Menu scene in Unity, and click Play to play the game, the Start Menu scene works: when I click on Start it loads the Game scene. Before clicking on Start, the Inspector shows this on the Start button, as expected:
image

However, if I load the Game Over scene in Unity, and click Main Menu, it loads the Start Menu scene, but the Start button doesn’t work. While the game was running, I checked the Start Button with the Inspector, and under On Click (), it says “Missing (Object)”:
image

I think partly this is because the Level object has the Singleton Pattern on it, and if I load my Start Menu scene first, which would always be the case when playing the game normally (not testing the Game Over scene by itself) it should work fine, however, I have now added the transition from Player losing to the Game Over scene, and the Level object is missing on the buttons in my Game Over Scene.

Anyone know how to fix this? Thanks.

Thank you.
P.S. Rick, this course is awesome! Your positive attitude makes it even more fun!

I got it working.

For the button in each scene, for On Click (), I had to drag the Prefab of the GameObject with the script with the Singleton Pattern in it (Level), on to the On Click(), then tell it what method to use.

Before, I dragged the Level GameObject from the Hierarchy into On Click (), and then it kept destroying the reference to the GameObject with the Singleton Pattern on it, and then the button would do nothing, as described in my first message.

I’ve put this here in case it helps someone else. Also, if there is anything wrong with my conclusions, please let us all know. Thank you.

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

Privacy & Terms