Error CS8025: Parsing error. HELP!

I am new to all this, and I have begun a project for a game based around aircraft. To begin Im just starting with a basic code and for some reason whenever I begin playing it just says “error CS8025: Parsing error!”

This is the code;

}
	var rotateSpeed = 25.0;
	var speed = 50.0;
	function Update() {
		var transAmount = speed * Time.deltaTime;
		var rotateAmount = rotateSpeed * Time.deltaTime;
		
		if (Input.GetKey("up")) {
			transform.Rotate(rotateAmount, 0, 0);
			
		}
		if (Input.GetKey("down")) {
			transform.Rotate(-rotateAmount, 0, 0);
		}
		if (Input.GetKey("left")) {
			transform.Rotate(0, -rotateAmount, 0);
		}
		if (Input.GetKey("right")) {
			transform.Rotate(0, rotateAmount, 0);
		}
		
		if (Input.GetKey ("z")) {
			transform.Rotate(0, 0, rotateAmount);
		}
		
		if (Input.GetKey ("x")) {
			transform.Rotate(0, 0, -rotateAmount);
		}
		
		if (Input.GetKey ("a")) {
			transform.Translate(0, 0, transAmount);
		}
		
		if (Input.GetKey ("q")) {
		transform.Translate(0, 0, (transAmount * 2));
		}
		
	}

Any help would be greatly appreciated. Thanks!

1 Answer

1

Your error message should refer to a specific line number which will tell you where the problem actually occurs (or within a line or two) and you should include that in your question.

With that said, if this is your complete code, you have a stray } at the very beginning, which will cause problems.

It seems like you're writing C# in which case "function" is not the right syntax instead do void Update(){

–

Yes, you have some C# and JavaScript stuff mixed together.

–

Ok, cheers for the help Dblfstr for the code, I am not recieving any "Cs8025" errors now, but NOW i am getting a new one; "Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor's mesh shapes! Please change mesh geometry or supply a tensor manually! UnityEditor.DockArea:OnGUI()"

–

Well, that a whole new question my friend. Close this one as answered, and start a new one.

–