Search Unity

how to hide/show a panel

Discussion in 'UGUI & TextMesh Pro' started by Oldnag, Nov 17, 2015.

  1. Oldnag

    Oldnag

    Joined:
    Aug 27, 2014
    Posts:
    22
    sorry if this has been asked but i have a window that i would like to show on button press and hide again on the same button how do i do this?
     
  2. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,255
    Something like the following
    Code (CSharp):
    1. public GameObject panelObject;
    2.  
    3. button click event ...
    4. {
    5.   if (panelObject != null)
    6.   {
    7.     panel.SetActive(!panel.activeSelf);
    8.   }
    9.  
    10. }
     
    DMorock likes this.