why one works, the other does not

why would one of these work (hit key E, it goes to position B) but the other does not (hit key Q, doesn’t go to position A)? thanks for any ideas/helps

		Vector3 positionA = new Vector3 (-45, 15, 0);
		Vector3 positionB = new Vector3 (-1, 4, 8);
		if (Input.GetKey (KeyCode.Q))
			newPosition = positionA;
		else { 
			newPosition = transform.position;
		if (Input.GetKey (KeyCode.E))
			newPosition = positionB;
			newPosition = transform.position;
		transform.position = Vector3.Lerp (transform.position, newPosition, smooth * Time.deltaTime);

It’s probably related to your if-else logic. Put some logs in there and see what’s getting executed.

Try this (pseudo):

newPosition = transform.position;
if (Q) newPosition = A;
else if (E) = newPosition = B;

there’s a redundant assignment but hey, if it works then you’ll know there’s a problem with you if-else

The reason for this is because of your if/else logic. If Q is hit then you correctly assign newPosition = positionA. But then you always reassign to newPosition afterwords in lines 10-14 so newPosition does not remain assigned to positionA.