Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by georetro · Jul 28, 2013 at 04:42 PM · javascriptsprinting

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 :)

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image robertbu · Jul 28, 2013 at 04:49 PM 0
Share

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.

2 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by Bunny83 · Jul 28, 2013 at 04:46 PM

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?

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image georetro · Jul 28, 2013 at 04:50 PM 0
Share

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

avatar image georetro · Jul 28, 2013 at 04:52 PM 0
Share

@Bunny83 Thanks man I solved it :)

avatar image Bunny83 · Jul 28, 2013 at 05:11 PM 0
Share

$$anonymous$$aybe you could:
to close your question?

avatar image Mr-_Sheepington · Jul 17, 2016 at 05:57 PM 0
Share

Boy that was an experience, after deleting about 14 'null' (?) lines, I then had to press the delete (not backspace) button on the last line to clear the rest of my code letter by letter. Fortunately I was only 14 lines in. That was really strange. Thank you nonetheless

avatar image
-1

Answer by Mikey_Bad052 · Nov 06, 2016 at 09:29 AM

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

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tanoshimi · Nov 06, 2016 at 12:09 PM 0
Share
  • Please don't post an answer to an existing question unless you're trying to answer it.

  • When you do ask a question, be precise and complete in describing the problem. Unity gives you error messages for a reason, and I'm sure they told you something more useful than your code was "stuffed up".

  • When including code, please format it correctly.

  • There are at least three obvious errors in your code: trasform? trnsform? On$$anonymous$$ouseup?

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Destroy GameObject A or B 1 Answer

Cube terrain with perlin noise 1 Answer

What is wrong with this script? 2 Answers

OnTriggerStay Not Working, JavaScript Help Needed 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges