Problem with Update.

Hey guys

I have a problem with Update method. On this I have an if that listen when a key is pressed, and this condition execute other method. My problem is that, when I press the key, the last method is executing more than once time. So, with debugger, I confirm that. I really appreciate if someone could help me. So that´s the code.

void Update () {
if (Input.GetButtonDown (“360_Start”) || Input.GetKeyDown(KeyCode.Escape)) {
Debug.Log(“Into Update”);
toggleRotacion ();
}
}

Thank you so much!!

Use GetButtonUp and GetKeyUp instead. Basically GetButtonDown and GetKeyDown are returning true for every single frame that the button or key is being held down, but GetButtonUp and GetKeyUp will only return true a single time and that’s when the key is pressed and released.

Thank you so much.
But It doesn´t work. The behavior is the same.
I really appreciate if someone could help me.

@Ryiah is right. Check that there aren’t multiple instances of your script in the scene.