#Creating an In-Game Menu (GameObject menu)

1 messages · Page 1 of 1 (latest)

upper shore
#

Hello! So I am trying to make a Level select screen that isn't UI but made with GameObjects, I have tried making one Game object then small ones as sort of buttons, then assigned a script that reads the following:

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

public class LevelSelect1 : MonoBehaviour

public GameObject button1;

{
    // Start is called before the first frame update
    void Start()
    {
        button1.SetActive(false);
    }

    // Update is called once per frame
    void OnMouseDown()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
}

(The reason I make it false is because I have another script that activates it before OnMouseDown is done, so that cant be the problem.)

#

^This didnt work

#

I have to walk my dog now real quick. any help is appreciated.

silver monolith
#

why not UI

#

What doesn't work? When you Debug.Log in your OnMouseDown, does it call? If not, check if you have a collider on the object you're clicking on

upper shore