top of page

Unity - Menu System

  • Writer: Emi
    Emi
  • Sep 16, 2020
  • 1 min read

gameobject > UI > Canvas

gameobject > UI > Button

Click on button > add component > new script > name "loadupscene"

Open the script in visual studio by clicking on the script in the project

Make the code look like this

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

public class Loadupscene : MonoBehaviour
{
    public string scene;

    public void loadScene()
    {
        SceneManager.LoadScene(scene);
    }
}

Return to Unity and look at the script component in your button's inspector.

Write the name of the scene you want the button to open in the scene box

Look in the button part of the inspector and click the + below the "on click ()"


Drag the button from the hierarchy into the "None (object)" section shown above

Click the drop down "no function" > loadupscene > loadscene ()

Recent Posts

See All
Unity Idle Animation

To animate a character or prop in a 2D game using Unity, the user needs a sprite sheet with small differences of pose between the...

 
 
 

Comments


bottom of page