GUI "Hider" Button

Hi everyone,
I’m pretty new on Unity (working on it still last year) and I already watched a few tutorials about the new Unity 5 GUI system.
Unfortunatly, they’re almost speaking about the same things.

I started to crated a “Sims-like” game (we can take some stuff from a GUI menu and put it on the 3D space, like an RTS) and I already designed ugly previews of the GUI panels, but I’m stuck : what’s the easiest way to make an “hider” button? (in screens, a button who can hide and show a pannel)


I hope this question isn’t already posted, otherwise I’m really sorry D:

Have a nice day

Parent all elements under single root transform, which could server as main panel.
Then simply edit the roots rectTransform anchored position and all child elements will move with it.

By guessing you already know how to attach methods to Button.

You just have to attach a method to “hider” button with a trigger which activates/deactivates objects.

	public void Hide( GameObject panel)
		panel.SetActive( !panel.activeSelf);

Attach this method to “hider” button. Drag your panel to ‘Gameobject’ paremeter in the Button inspector. This method deactivates Panel if its active vice versa.

Thanks guys,

I tried your both methods and it perfectly works.
Finally, that was easier than I thought !