- Home /
 
error: ';' expected. Insert a semicolon at the end.
every time I import a script this message pops out error: ';' expected. Insert a semicolon at the end.so I just wanna know what is wrong with my script here it is and if there is anything wrong pls inform me
 #pragma strict
 
 var rayLength = 10;
 
 private var treeScript : TreeController;
 
 private var playerAnim : Arms Controller;
 
 function Update()
 {
     var hit : RaycastHit;
     var fwd = transform.TransformDirection(Vector3.forward);
     
     if(Physics.Raycast(transform.position, fwd, hit, rayLength))
     {
         if(hit.collider.gameObject.tag == "Tree")
         {
             treeScript = GameObject.Find(hit.collider.gameObject.name).GetComponent(TreeController);
             playerAnim = GameObject.Find("FPSArms_Axe@Idle").GetComponent(PlayerControl);
             
             if(Input.GetButtonDown("Fire1") && playerAnim.canSwing == true)
             {
                 treeScript.treeHealth -= 1;
             }
         }
     }
 }
 
              Not for nothin, but syntax errors like Unexpected Characters and Parsing Errors are not supposed to pass moderation AFAI$$anonymous$$. Usually I refer them to FAQ, glance them over, answer if I spot the problem, then reject it.
This isn't an answer but hey fellow SpeedTutor buddy, I had a problem with this script before but not the same one, also what line does the error say it's on?
Answer by Graham-Dunnett · Jul 30, 2015 at 06:36 PM
You are ignoring the line which the compiler has the error. I assume it says line 7. Which should make you spot that the variable type has a space in it. The compiler assumes that the space is the end of the statement and so needs a semicolon.
(Also, note that it's expected for Unity users to include full details about their problems on this site. You are avoiding including the error number, UCE0001 which I have added for you. Also, when you need help, just search for these errors and you'll get lots of help and not need to post a duplicate question.)
thanks so much for replying so fast but if I removed the space I get this error The name 'ArmsController' does not denote a valid type ('not found'). if u can maybe it would be better if u just edited it for me and placed it here so I can copy it and sry for bothering u
Check the "Arm Controller" class name as well as the file name if it is a $$anonymous$$onoBehaviour script. All should be ArmController, without spaces.
Your answer