Its all on the same scene. An options list will open up, and there will be various buttons to select an option. I got the panel to show up after clicking the button.
I did the exact same thing as the panel, even hiding it on the canvas and only appearing when the button is clicked. I think the problem is, the panel is a game object but the button isn’t.
Here’s the code that got the panel to appear, but relacing the “panel” words with an option I wanted, didnt work.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PanelOpen : MonoBehaviour
//gives us an options panel on the same screen after clicking a button
{
public GameObject Panel;
public void OpenPanel()
{
if (Panel != null)
{
bool isActive = Panel.activeSelf; //need to add this line to make the toggling work
Panel.SetActive(!isActive); //this makes it so the panel stays open
//change "true" to "!isActive" to make the toggling work
}
}
}
I don’t quite understand your question… calling OpenPanel() above should make the panel appear, and you indicate that it does appear, so you have to be really close… What exactly are you having difficulty with?
after the panel appears, there should be a list of buttons the person can click on, but those buttons dont appear when I used the same code for the buttons but change the words where I have to (replacing all the “panel” words in the code with “inventory”).
So, “open panel” button opens the side panel, but how I want to make it so it also makes the other buttons appear when the side panel opens then the buttons disappear with the side panel after I close it.