Hello! I’ve been following the Tornado Twins tutorial on how to make a game but I’ve come across a snag. I’ve been trying to fix this for a while now and it’s baffled me - I cannot tell what has gone wrong, nor can a friend who has successfully completed said tutorial. Could somebody point out the error?
var speed = 3.0;
var rotateSpeed = 3.0;
var BulletPrefab: Transform;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
//Rotate on Y
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotrateSpeed, 0);
//Move forward/back
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);
If(Input.GetButtonDown("Jump"));
{
var bullet = Instantiate(BulletPrefab, GameObject.Find("spawnPoint").transform.position, Quaternion.identity);
}
}
@script RequireComponent(CharacterController)
The errors are:
Assets/MoveAround.js(18,25): BCE0043: Unexpected token: var.
Assets/MoveAround.js(18,28): UCE0001: ';' expected. Insert a semicolon at the end.
Assets/MoveAround.js(20,1): BCE0044: expecting EOF, found '}'.
Thank you in advance.
Remove the ; off the end of the if statement line.
Regards,
Matt.
read the error and some will tell you what to do
That adds another error into it, though. It says it expects one on the line when there isn’t one.
what did you change did you erese the ; and change it to a : ?
No, I removed it.
If(Input.GetButtonDown("Jump"));
became
If(Input.GetButtonDown("Jump"))
The If should also be if… lower case i
and there is a typo in your rotatespeed variable in the transform line.
var speed = 3.0;
var rotateSpeed = 3.0;
var BulletPrefab: Transform;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
//Rotate on Y
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
//Move forward/back
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);
if(Input.GetButtonDown("Jump"))
{
var bullet = Instantiate(BulletPrefab, GameObject.Find("spawnPoint").transform.position, Quaternion.identity);
}
}
@script RequireComponent(CharacterController)
That should compile…
Yes, it works perfectly now! Thank you!
What I recommend to do next time is read though the error that unity gives you 
90% of the time its just a typo or syntax error, which unity points you out what is wrong and possibly how to fix.
And if you still fon´t understand try looking up the error from google, just type: unity myerror