- Home /
Best way/place to implement GUI? (scenes/levels/layers? - opinions wanted)
So, I'm going to have 2 types of GUIs in my project.
One is a constant set of tools/buttons/whathaveyou that is always "on".
Two, I'd also like to have a "settings" menu that the user can open up and change.
My question is what is the best way/location to implement these things? As separate scenes, layers, or levels? That's the core thing I'm looking for opinions on.
Thanks for any guidance!
Answer by Ashkan_gc · Mar 13, 2011 at 08:22 PM
scenes are not generally a good concept to manage code with them. levels and scenes are the same. i recommend creating components for each of your GUI panels and attach those components to some sort of manager objects. then add those manager objects to scenes that you want to have the GUI.
about your settings menu you can do this too. you should just check for pressing a key like ESC or create a drop down menu using unity GUI. i don't know what exactly you want.
Thanks. It was just a general question. The "settings" menu will be some controls over how a scene is rendered (colors of gameobjects, etc).
Answer by Statement · Mar 13, 2011 at 08:47 PM
I'd create a prefab and have each game level include that prefab. Alternatively have a script that creates the prefab during Awake or Start. Some people might use some sort of object that is DontDestroyOnLoad in the main scene but then you'd be having a hard time editing/testing/debugging levels since you'd have to load the main scene first to include them. Since you can't easily swap between scenes (and remember all of the scene states), going with a menu in a dedicated level can become troublesome. If you still opt to go with that route, you could probably do some tricks with additive level loading. However I personally think a prefab/script in each level is the best choice.