Menu problem

I am having a problem with my start game menu. I already have a code that works with the mouse just fine but I also want the player to be able to push the Enter button to start the game. However, I can not get the keys to work.

if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey ("enter")) 
 {
 Application.LoadLevel(1);
 }

I’ve tried other keys like “return” and “a” and I can’t get any of them to do anything. Any ideas what the problem is?

Thanks.

if (Input.GetKey(KeyCode.KeypadEnter)||(KeyCode.Return)) 
 {
 Application.LoadLevel(1);
 }

Nope, still nothing happens.

fixed,i’ve try it and now works.

Now it instantly starts the game before I touch anything. 0_o;

just subdivide it:

if (Input.GetKey(KeyCode.KeypadEnter))
 {
 Application.LoadLevel(1);
 }

if (Input.GetKey(KeyCode.Return)) 
 {
 Application.LoadLevel(1);
 }

Still nothing. The KeypadEnter doesn’t work either. I haven’t gotten any keyboard commands to work thus far. I’ve also tried Escape, Backspace, letters, and numbers and nothing I put in will start the game. Here is my entire code, maybe that will help.

var isQuitBtn = false;

if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Return))
{
Application.LoadLevel(1);
}

function OnMouseEnter()
{
renderer.material.color = Color.green;
}

function OnMouseExit()
{
renderer.material.color = Color.white;
}

function OnMouseUp()
{
if(isQuitBtn)
{
Application.Quit();
}

else
{
Application.LoadLevel(1);
}
}

EDIT:

Ok, I’m an idiot. XD I forgot to put it in an Update function. Thanks for the help! :slight_smile: