Why does the first Input.GetKey in this script not work? I've tied swapping them around, and it's always the first that doesn't work. I've done this before, but this is the only time this behavior shows up. Thanks.

void FixedUpdate () {

	if (Input.GetKey ("n")) {
		transform.rotation = leftTo.rotation;
	} 

	if (Input.GetKey ("m")) {
		transform.rotation = rightTo.rotation;
	}
	else {
		transform.rotation = fromRot.rotation;
	}

}

So, if you press the “n” key then line 5 is performed.

Then, you’ll check for “m”, which isn’t pressed. So, you’ll execute line 12, because “m” wasn’t pressed. If “n” was pressed, then line 12 is still executed. So then the rotation is set to the value specified on line 12. Which overwrites what happened at line 5.

What you probably want to do is have a else, so:

if (Input.GetKey ("n")) {
} else {
    if (Input.GetKey("m")){
    } else {
    }
}