- Home /
Where to put the GUI script ?
I dont know if its a good question to ask, the answer might be obvious for the most people, however I am not really sure what is the best practice when placing your GUI script. Should it be for example put into the camera script, or bind to an empty object etc ? Even though they will give the same result for the most cases, I want to know whats the best way for placing your GUI scripts.
Answer by aldonaletto · Dec 28, 2011 at 10:32 AM
I suggest an empty object named "GuiObj" or something else meaningful enough, thus you will always know where to find the GUI scripts.
You can add the GUI script to any scene object, but usually we attach GUI scripts to a dedicated empty object, to the camera or to the player. The camera usually is somewhat crowded with components and the camera script, and the player is yet more crowded, thus using a dedicated empty object makes things a little easier.
Answer by Grady · Dec 28, 2011 at 10:42 AM
Well, it can depend what the GUI script is doing...
Most of the time, I have, like a game controller game object, which I place most scripts on that are to do with the whole game...
Other things for say the player, I attach to the player etc.....
Hope this helps you with your decision!!!!!!!!
-Grady
Answer by charnew · Dec 28, 2011 at 01:36 PM
when its something like you are just doing a main menu, you put it to the main camera
Your answer
![](https://koobas.hobune.stream/wayback/20220613062438im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
GUI Error - Method not found: 'GUI.BeginGroup'. 1 Answer
Same GUI script showing up in different places 0 Answers
Scrolling Text 1 Answer
Button Turns Off and On Object 1 Answer
Null reference exception[SOLVED] 1 Answer