how to hide/show a panel

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?

Something like the following

public GameObject panelObject;

button click event ...
{
  if (panelObject != null)
  {
    panel.SetActive(!panel.activeSelf);
  }

}
1 Like