First Create a Hierarchy similar to this, with a Main parent and the pages as children.

MainMenu
>>Page_Main
>>Page_Settings
>>Page_HostGame

Then create this class and add it to the MainMenu GameObject.

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

namespace HBS.UI
{
    [Serializable]
    public struct MenuPage
    {
        public string Name;
        public GameObject Page;
    }

    public class MenuManager : MonoBehaviour
    {
        [SerializeField] private List<MenuPage> MenuPages = new List<MenuPage>();
        [SerializeField] private string StartingPage = "MainPage";

        private void Awake()
        {
            ShowPage(StartingPage);
        }
        public void ShowPage(string name)
        {
            foreach (MenuPage page in MenuPages)
            {
                page.Page.SetActive(page.Name == name);   
            }
        }
    }
}

Then, use the unity ui buttons to call the ShowPage on each button, and pass the name of the page you want to show.

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram