Stop input from receiving?

My code detects for enter to be pushed, however, after enter is pushed, it already detects enter for the next menu. Any way to remove the input detection of enter?

Any help would be greatly appreciated, thanks a lot!

Here’s the code.

		if(selectCharacter)
		{
		if(Input.GetKeyDown ("s"))
			selectionGridInt++;
		if(Input.GetKeyDown ("w"))
			selectionGridInt--;
		if(Input.GetKeyDown("return"))
			{
				selectCharacter = false;
				selectMove = true;
				selectionGridInt2 = 0; 
			}
		}
		if(selectMove)
		{
			if(Input.GetKeyDown ("s"))
				selectionGridInt2++;
			if(Input.GetKeyDown ("w"))
				selectionGridInt2--;
			if(Input.GetKeyDown("return"))
			{
				selectMove = false;
				selectSpell = true;
			}
		}
		if(selectSpell)
		{
			selectionGridInt3 =0;
			if(Input.GetKeyDown ("s"))
				selectionGridInt2++;
			if(Input.GetKeyDown ("w"))
				selectionGridInt2--;
		}

Look at how your logic is organized.

  • if(selectCharacter) and Input.GetKeyDown(“return”) then selectMove is set to true.
  • Now if(selectMove) is true and Input.GetKeyDown(“return”) is still detected in this frame then that code is executed.

Use else if :

if (selectCharacter)
{
    // only do this
}
else if (selectMove)
{
    // only do this
}
else if (selectSpell)
{
    // only do this
}