Hey guys, I’m creating a game for a Uni project and as simple as it may sound I’m just looking to find out the best way to come about making a start up screen for my game, which will include buttons like “Start Game”, “How To Play” and “Quit” I know the simple code to make the buttons through GUI but I’ve made some buttons of my own through Photoshop and was wondering how I would implement them into buttons?
What you can do, is export your buttons from photoshop as .PNG and import them into unity.
Then create a new plane by going to:
GameObject > Create Other > Plane.
Then drag your three different buttons onto three different planes. Once you have done that, then position a camera where it can see your buttons in a scene.
Then add colliders to each plane, and a script like this:
function OnMouseDown(){
Application.LoadLevel("yourFirstLevelToLoad");
}
Then just change yourFirstLevelToLoad to the name of the scene which you want to play when the player clicks on the “Start Game” button.
Save the script and then attach it to the “Start Game” button.
You would want to do the same thing for the “How To Play” button as well!
Then for the quit button, just add the same code once again, but change Application.LoadLevel("yourFirstLevelToLoad"); to Application.Quit(); which, when clicked, will quit your game!!!
Hope this has helped you, and if not, feel free to comment back!!!
U can use GUI Styles or GUI Skins to create nice looking GUI. You can change the texture for example when the player hoovers over the object or clickes on it.
Just check out the script reference about GUI.
I realize it’s been a few years since this question was asked and answered but considering I ran into it looking for help, others may as well.
Just a note:
You do NOT need to add a collider to the plane as Grady said. It may have been like that in the older version but on the newest version (4.3.0f4) it is not necessary.
Thanks guys, yeah I know he pretty much has told me how to do it, but I do havea deadline soon so giving the code is much appreciated! I will be looking into this further so that I can remember it in the future (: but thanks guys!