Unexpected char : 0x0

Hello everyone! I am struggling with a piece of my sprinting script. I have added in a block of code that says when you press left shift it plays the running animation and when you let go, it stops it!

When I saved it I got an error saying: BCE0044: unexpected char: 0x0.

Here is the code:

var walkSpeed : float = 7; // Regular Speed
var sprintSpeed : float = 13; // Run Speed

private var charMotor : CharacterMotor;
private var charController : CharacterController;

function Start () {
	charMotor = GetComponent(CharacterMotor);
	charController = GetComponent(CharacterController);
}

function Update () {
	// Making the actual speed var
	var speed = walkSpeed;
	
	// Checking for oppertunity to sprint
	if(charController.isGrounded && Input.GetKey("left shift") || Input.GetKey("right shift")){
		speed = sprintSpeed;
	}
	
	// Changing the speed to sprint
	charMotor.movement.maxForwardSpeed = speed; // Setting the speed
	
	if(Input.GetKeyDown(KeyCode.LeftShift)){
    	animation.Play("m4_run");
	}
	
	if(Input.GetKeyUp(KeyCode.LeftShift)){
    	animation.Stop("m4_run");
	} // This is where the error keeps on pointing to
}

If anyone could help I would be very grateful :slight_smile:

You somehow managed to copy a null-byte-character into your source code. Try open the file in another editor and resave the file. That might help. Other than that i would use a hexeditor and search for the null byte. You usually can’t see the null character, so it’s hard to delete it inside MonoDevelop.

btw: Shouldn’t Unity give you at least a line number and a column where the error occured?

This happens to me to this is a pickup item code here it is:
var target : Transform;

function Update () {
}

function OnMouseDown () {
this.trasform.position = target.position;
this.transform.parent = GameObject.Find(“FPSController”).transform;
this.transform.parent = GameObject.Find(“FirstPersonCharacter”).trnsform;
}

function OnMouseup () {
this.transform.parent = GameObject.Find(“FPSController”);
this.transform.parent = null;
}
Please help me fix it
Thanks Me