Skip to content

ThirteeNov

My personal blog about coding and internet

Menu
  • About me
  • About Zofia Kreasi
  • Cart
  • Checkout
  • Making an airplane game from scratch in Unity
  • My account
  • Privacy Policy
  • Privacy Policy – zkLeaderboard
  • Sample Page
  • Shop
  • Tutorials on Learning JavaScript
  • ZKAccounts – Privacy Policy
Menu

How to create simple menu navigation and switch between menu screens in Unity

Posted on October 9, 2019August 4, 2020 by Habibie

I’ve made a step by step video tutorial to create a basic menu and navigation script in Unity3D.

So basically you can see the Main Menu with two buttons to navigate to its sub menus, and in each sub menus you have a back button to go back to Main Menu.

In this video you will see how to switch between menu screens in one single Unity scene.

Watch the video and for coding part, create a C# script in Unity then copy and paste this code into the file:

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

public class MenuScript : MonoBehaviour
{

    public GameObject MainMenu;
    public GameObject Screen1;
    public GameObject Screen2;

    // Start is called before the first frame update
    void Start()
    {
        BackToMainMenu();
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void HideAllScreens()
    {
        MainMenu.SetActive(false);
        Screen1.SetActive(false);
        Screen2.SetActive(false);
    }

    public void OpenScreen1()
    {
        HideAllScreens();
        Screen1.SetActive(true);
    }

    public void OpenScreen2()
    {
        HideAllScreens();
        Screen1.SetActive(true);
    }

    public void BackToMainMenu()
    {
        HideAllScreens();
        MainMenu.SetActive(true);
    }
}
Post Views: 379
ciihuy2020

Welcome!

  • My YouTube Channel
  • My GitHub Page
  • About me

Categories

  • 3DVista
  • Android
  • Apache
  • C#
  • Cordova
  • Electron & Node JS
  • HTML5, CSS & JavaScript
  • iOS
  • Let's Make Unity Games
  • Misc
  • Photoshop
  • PHP
  • Python
  • Uncategorized
  • Unity
  • WordPress

Recent Posts

  • Hover Reveal script for Unity to show and hide object on mouse hover
  • How to Prevent UI Clicks in Unity from “Bleeding Through” to 3D Objects Behind Them
  • Make objects like wires and cables easily in Unity using Ciihuy Curved Mesh
  • [SOLVED] Can’t Add Custom Domain to Blogger After Losing CNAME Verification
  • iOS App Icon Generator by CiihuyCom
© 2026 ThirteeNov | Powered by Superbs Personal Blog theme