- Home /
 
Code Not Working. Any Ideas?
Hey guys Im following a tutorial on youtube from the TornadoTwins. This is the script I was told to use for my Move Around prefab.
var speed = 3.0; var rotateSpeed = 3.0; var bullitPrefab : Transform;
 
               function Update () { var controller : CharacterController = GetComponent(CharacterController);
 
                transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
 var forward = transform.TransformDirection(Vector3.forward);
 var curSpeed = speed * Input.GetAxis ("Vertical");
 controller.SimpleMove(forward * curSpeed);
 if(Input.GetButtonDown("Jump"))
 {
     var bullit = Instantiate(bullitPrefab, 
                    GameObject.Find("spawnPoint").transform.position, 
                    Quaternion.identity);
 }
 @script RequireComponent(CharacterController);
  
               I keep getting this error:
Assets/Move Around.js(23,5): BCE0044: expecting }, found '@script'.
Any idea on the fix?
Answer by Statement · Jan 10, 2011 at 06:01 PM
Yeah, you haven't closed your Update function. Also you have a ; at your @script line ending which will produce an error "expecting EOF, found ';'".
var speed = 3.0; var rotateSpeed = 3.0; var bullitPrefab : Transform;
 
               function Update () { var controller : CharacterController = GetComponent(CharacterController);
 
                transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
 var forward = transform.TransformDirection(Vector3.forward);
 var curSpeed = speed * Input.GetAxis ("Vertical");
 controller.SimpleMove(forward * curSpeed);
 if(Input.GetButtonDown("Jump"))
 {
     var bullit = Instantiate(bullitPrefab, 
                    GameObject.Find("spawnPoint").transform.position, 
                    Quaternion.identity);
 }
 
               }
 
               @script RequireComponent(CharacterController) 
 
               
               Try this. I added the } and removed the ;
thanks it worked...im really enjoying how fast my questions get answered.
Well, welcome to the world of Unity Answers. $$anonymous$$ost questions get really quick replies here. :)
Your answer
 
             Follow this Question
Related Questions
Script error. Please Help! 4 Answers
'If' Statement in javascript giving me problems 3 Answers
BCE0044: expecting ':' found ';' 1 Answer
Basic on collision play animation code not working 1 Answer
BCE0044: expecting :, found '=' 3 Answers