MissingFieldException: Field 'UnityEngine.Transform.Rotation' not found.?

I am making an FPS Parkour game where the player will be able to do flips. ‘e’ key to flip forward, ‘q’ key to flip backward. I used a simple rotation script. The problem is that sometime the x,y, and z rotation axis’s need to be reset. Using other scripts and my own skills, I wrote this simple script.

var TargetObject:Transform;
function Update()
{
if (Input.GetKey("r"))
  {
    TargetObject.Rotation=Quaternion.Euler(Vector3(0,0,0));
  }
}

It is not working and I get an error that says this.
MissingFieldException: Field ‘UnityEngine.Transform.Rotation’ not found.
Any suggestions?

It’s Transform.rotation, since rotation is a variable of the Transform class. I’d recommend sticking to the Unity convention of always using lowercase for variables and uppercase for classes and methods, since it makes this sort of thing easy to catch.

–Eric

Thank you very much sir! It works now! I will remember that in the future.