top of page

Unity Menu Coding

Menu Canvas.PNG

- Create two scenes

- In one scene, create a canvas and a button. These are found in GameObject > UI. The canvas mirrors itself onto the camera, so if the button is placed in the middle of the canvas it will appear at the middle of the screen when you play the game.

- In the button inspector add a new script component and double click it to open it in visual studio. Then enter the following code:

Menu Code.PNG

- Save and minimize visual studio

- There should now be a box to input the scene name. Type the name of the other scene.

- In the inspector there should be an 'On Click' box. Click the plus icon, then drag the button from the hierarchy into the box. In the drop down menu there should be an option with your script name. From here, select loadScene

Menu Inspector.PNG
bottom of page