How to get a list of all the GUI elements in a scene?

I would like to know how to get a list of all the GUI elements in a scene and disable them (make them invisible).

Thanks in advance

You can make all GUI controls invisible by not drawing them.

This can be done using a boolean to track whether or not the GUI should be drawn. If it is false, have your scripts either exit the OnGUI function immediately or not draw certain controls.

I’m not sure there is a way to get a list of all the GUI controls in a scene. I’m don’t know if that makes sense given the way Unity approaches its GUI system. Based on the way the controls are drawn from frame to frame, I’m not sure a list of this kind is maintained.

That being said, the state of Toggle buttons is obviously mainained, so maybe there is such a list. If there is such a thing, it should be in the documentation somewhere.