Follow 5 simple steps to create Game Menu in Unity 3D:
Step 1: Determine Your Game Resolution
Open the Player settings via the top menu, Edit > Project Settings > Player and enter your default screen width and height values into the inspector. I chose to leave mine as the default 600x450px as shown below.
Step 2: Creating the Menu Scene
Select the game scene(Your game Scene) within the Project view and duplicate it using Ctrl/Command + D, then rename the copy to “menu” and double-click it to open it.
Note: You can confirm which scene is open by checking the top of the screen, it should say something like “Unity – menu.unity – ProjectName – Web Player / Stand Alone”. You don’t want to start deleting parts accidently from your game scene!
Step 3: Adjusting the Build Settings
From the top menu select File > Build Settings and drag the menu scene from your Project View into the Build Settings’ “Scenes In Build” list as shown below
(Make sure you rearrange the scenes to put “menu.unity” at the top, so that it’s the scene that’s loaded first when the game is played.)
Step 4: Adding the Play Button
We’re going to use 3D Text for our menu, so go ahead and create a 3D Text GameObject via the top menu: GameObject > Create Other > 3D Text, then rename it “PlayButton”.
Finally, add a Box Collider via the top menu: Component > Physics > Box Collider. Resize the Box Collider to fit the text if it doesn’t fit it nicely on the PlayButton.
Step 5: The Mouse Handler Script
/**
Mouse Down Event Handler
*/
function OnMouseDown()
{
// if we clicked the play button
if (this.name == “Play”)
{
// load the game
Application.LoadLevel(“game”);
}
}
After clicking on the play button:
Your game view will be like:
– By
Sonu Odesi
Comments are closed.