- Home /
How to make a File, Edit, Preference Menu?
I'm trying to make a toolbar menu and I was looking at the scripting reference for toolbar, but I'm unsure how to use it exactly. I want to make just a standard File -> Save/Exit, Edit -> Undo/Redo, Preferences -> Options kind of toolbar. Can anyone point me to the right direction?
Answer by IgnoranceIsBliss · Jan 24, 2012 at 12:11 AM
It's not something Unity was specifically designed to do, but you can do it using the GUI controls.
GUI.Label draws text, GUI.Box creates boxes (which can then be filled with text and buttons if you like) and GUI.Button makes buttons. A box of buttons would create a menu - so you can combine these primitive parts to create a basic menu system.
Check out the GUI reference - it's not going to be very easy or straight-forward though, you'll have to build everything yourself. There's no standard Unity framework for drop-down menus - but you could check the Asset Store in case someone else has done it.
Fundamentally Unity is a game engine, and very few games have file menus - which is why it's not included as a standard feature.
I get what you are saying. I think I can figure it out using boxes, text and buttons and some textures. Yeah I'm trying to make a map editor within a game engine so I definitely have had to think outside the box a few times. Thank you for your input :D
You'll probably want to use a GUI Skin on your menu - that way you can make all of your buttons come out looking like menu items and at the same time don't need to hard-code your appearance data.
$$anonymous$$ake a new skin specifically for your menus and it will make your code clean and make it $$anonymous$$UCH easier to make changes in the future!