I’m looking for a good way to handle many different GUI layouts and switching between them. Any ideas?
Are the layouts all versions of the same thing but in different positions and sizes? If you are doing it that, then I suggest you make a copy of your original layout, and move that copy around until you are satisfied with the new layout. Do that for all layouts, then disable all except for your “default” one. Finally, whatever script is switching layouts should have references to all the parent objects of each layout and call GameObject.SetActiveRecursively(true) to the new layout, and GameObject.SetActiveRecursively(false) to all others.
This way is preferable to having a script dynamically change the positions and scales of just one layout, because that’s a pain to maintain and keep an easy workflow.
Unfortunately, GameObject.SetActiveRecursively() can be a problem if you are trying to enable a layout that requires child objects to be hidden at under certain conditions, because it turns them all visible. If it becomes a problem, then I suggest you make a helper script that calls GameObject.SetActive() when some message, like “OnActivate” is sent. Then, attach that script to all objects you want acitive when the switch happens, and call GameObject.BroadcastMessage(“OnActivate”)
Additionally, another problem with doing it this way means that all the local data in each layout hierarchy will be different between instances, so you make want that data to be static and update from static when the switch happens.
This is the best way I’ve found. It requires a bit of overhead to program, but once its in place it makes iteration simple.