A question that’s probably been asked quite often but after surfing the tutorials and references for a while I’m still at a bit of a loss.
How do you create a simple full screen main menu for when your project/game starts up?
To give more detail into what I’m looking for. The game I’m making is a single scene gameplay demo. I’d like a main menu that has a full screen image and 3 buttons; these three buttons need to direct the player to:
1: Initiate the scene. Allowing the player to start the level.
2: Jump to a still full screen image that showcases the controls of the game.
3: Jump to a still full screen image with the credits of people who worked on the game.
I did try to engage the GUI scripting guide: http://unity3d.com/support/documentation/Components/GUI%20Scripting%20Guide.html But as I’m nether a programmer or have any aptitude with scripting this just somewhat baffles me. [I’m a level designer and artist.] I’m not even sure where I’m supposed to paste the example scripts into, as there are multiple GUI styles, assets and component types.
If there are any more specific tutorials or works that addresses the task of creating a full screen overlay main menu I would love to get a hold of it!
class Redirection extends Object{
var _On : Texture2D;
var _Off : Texture2D;
var Redirect : int;
var Name : String;
}
So here you can define a prefab using this code and call it MainMenu and then create another and call it InGameMenu.
Using this system, you can define pages to be fullscreen or not.
You simply create the number of pages you want to display then define each page’s settings individually.
If it is a menu containing only buttons, just create how many buttons it should have and set the On and Off texture for each so the text can be highlighted when the user selects the text via keyboard. Making the text have no background but selecting a button image in your skin you can have the button change color when mouse moves over it, and have the text change when the user selects the button via keyboard. Which one is selected depends on wether the user presses Enter or left mouse button…
Set the redirect on each button to tell it which menu page to display and tick the FullScreen option to display your background or don’t check it to not show the background and have your buttons hover over your scene for in-game menus
If the page does something specific like lets you change settings, then give that page an ID and in the code code what should happen when that ID is current.
This entire system is then attached to another prefab that contains a camera and a cube. The images specified are used as the texture for the cube and the camera is activated when the menu is called.
It is a very complex menu system and I think it will be hard to learn if you intend to use it, but it serves my purposes.
Once again, it (and anything you do in code) can be as simple or as complex as you want it to be…