Can someone help me with creating a menu when you hit “P” it asks if you want to; Restart, Quit, Resume?
This is very broad. Could you attempt it a bit, and then ask when you have a problem?
BTW, as far as I know, you have to use scripting for this.
Like Sethbeastalan said, it’s a very broad question, but here are a few things you’ll probably want to take a look at:
GUI/GUILayout.Button() (for the menu buttons)
Application.LoadLevel() (for restarting - it’s not the only way to restart, but it’s probably the easiest way)
Application.Quit()
Time.timeScale (for pausing physics and/or other time-dependent behaviors)
‘enabled’ (a field that can be used to effectively pause certain object types)
That’s not comprehensive by any means, but it should be enough to get you started.
Like, idk where to start, cause idk how to make a menu pop up when a button is hit, so can someone post a tutorial?
For the ‘making the menu pop up when a button is hit’ part, take a look at Input.GetKeyDown(). The basic logic for what you want to do will look something like this (pseudocode):
in Update()...
if p was pressed
paused = !paused (paused should be a boolean variable - this will toggle it)
if paused
pause the game here (set Time.timeScale to 0, etc.)
else
unpause the game here (set Time.timeScale to 1, etc.)
in OnGUI()...
if paused
do your GUI here
Now, here’s what you should do (IMO). Write a script that prints a message to the console using Debug.Log() when the ‘p’ key is pressed, and nothing else. Attach the script to a game object and see if it works.
If that doesn’t work, post your code here with a description of the problem, and we’ll help you.
If it does work, add a boolean ‘paused’ variable to the script, and toggle it when ‘p’ is pressed. Print the new value to the console, and see if the value is as expected when you press the ‘p’ key. (It should alternate between false and true every time the key is pressed.)
If that doesn’t work, post your code here with a description of the problem, and we’ll help you.
If it does work, add an OnGUI() function, and in the OnGUI() function, if the ‘paused’ variable is true, display a single label onscreen that says (e.g.) ‘Paused’. Now, pressing the ‘p’ key should alternately show and hide this label.
If that doesn’t work, post your code here with a description of the problem, and we’ll help you.
If it does work, replace the ‘paused’ label with three calls to Button(), with the three buttons labeled Restart, Quit, and Resume. In the conditional associated with each button, print out a corresponding message using Debug.Log(). Now, when you pause and click the buttons, you should see messages like ‘Resume’ and ‘Restart’ in the console, depending on which button you clicked.
If that doesn’t work, post your code here with a description of the problem, and we’ll help you.
If it does work, you can move on to the next step.
Are you starting to see how this works? Unless someone decides to be exceedingly nice, that’s probably as close to a tutorial as you’re going to get
But that should absolutely be enough to get you started. Give it a go, report back here with any problems you run into, and we’ll be glad to help.
I suggest you look at the Lerpz tutorial - especially page 50 onwards in the pdf that refers to the GUI and level restart elements. That should give you a start.
http://download.unity3d.com/support/resources/files/3DPlatformTutorial.pdf