Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question UI button will set panel visibility to false but not true

Discussion in 'UGUI & TextMesh Pro' started by Josh2206, Sep 4, 2023.

  1. Josh2206

    Josh2206

    Joined:
    Apr 4, 2023
    Posts:
    3
    I'm trying to create a menu with several buttons which show other menus when clicked.

    I have a game object which shows a panel with a button when clicked. Clicking the button on panel 1 should toggle panel 2, but if panel 2 is hidden the button won't show it. If I leave panel 2 visible when I run the game, clicking the button hides panel 2, but clicking it again does nothing.

    I'm using the built in On Click () function with GameObject.SetActive and panel 2 dragged in from the inspector.