Before updating to Windows 10 you may need to return your Pro license. More information here

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
     } // This is where the error keeps on pointing to

If anyone could help I would be very grateful :)

more ▼

asked Jul 28, 2013 at 04:42 PM

avatar image

40 9 12 57

I just copied and pasted the code from above, and it worked fine, so copying and pasting into UA fixed the problem. You should be able to just copy and past the script back in from your question.

Jul 28, 2013 at 04:49 PM robertbu
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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?

more ▼

answered Jul 28, 2013 at 04:46 PM

avatar image

96.9k 54 297 527

@Bunny83 30,10 is the line number and column! Also thanks for that :D

Jul 28, 2013 at 04:50 PM georetro

@Bunny83 Thanks man I solved it :)

Jul 28, 2013 at 04:52 PM georetro

Maybe you could:
to close your question?

Jul 28, 2013 at 05:11 PM Bunny83
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Jul 28, 2013 at 04:42 PM

Seen: 1802 times

Last Updated: Jul 28, 2013 at 05:25 PM