- Home /
Start Up Menu For 2D Game
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?
Thanks in advance!
Answer by Grady · Dec 15, 2011 at 08:57 AM
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!!!
-Grady
Your answer is pretty much the same as $$anonymous$$e but yours is best explained maybe, more code orientated. All in all I guess point is made. $$anonymous$$y point in giving fewer details is just that for the guy to learn he needs to put a little work in it. If you give him the answers he will just copy paste. I have seen many people on this forum complaining that some questions are simply "What is the code for" so my contribution is to give an algorithm like explanation more than the actual code (even though I gave some code things there too...)
True, but hopefully he will be able to understand this and then research for himself in the future!!!!! But yes, my answer is pretty much yours in more detail!!!!
Answer by BarkShark · Dec 14, 2011 at 07:24 PM
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.
Answer by Rikanano · Dec 16, 2011 at 01:59 AM
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!
JD
Answer by swag_swag · Mar 18, 2014 at 03:12 AM
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.