0
votes

I'm trying to create a start menu for my unity 5.3.1 game by following this tutorial : https://www.youtube.com/watch?v=pT4uca2bSgc

I followed everything he said up to the part when he attached the script to the start button on the main menu screen. Here is a picture of my code and editor:

editor

code

Any help is appreciated thanks.

1
To attach a script to a GameObject, you either click the Add Component button in the inspector when having that object selected, or you can also Drag&Drop the script file from the file viewer in the Editor unto the game object you want. You're probably not seeing any search results because you're searching within you scene (where that script doesn't exist yet). If that doesn't help, you should mark the minute in the video on which you're stuck. - Maximilian Gerhardt

1 Answers

1
votes

You have attached that Title script to the "canvas" Canvas Game Object - not the "start1" Button Game Object.

In reality in doesn't matter, because you can tell your button to call any method on any game object when clicked.

To do that, select your button, for the OnClick event drag the Canvas game object, then from the drop down select the Title script and the startLevel() method.

Now when you click the button your level will load.