- Home /
Very new to scripting: Apparently I have a unexpected token?
So I have an unexpected token of a ; at the end of a var, so I removed it, than it said it was an expected token... I am completely new to all this, and all the scripting i've been doing has been following a tutorial, so if it was all completely wrong I wouldn't know. Can someone please tell me how to fix this, as I only just found out what an unexpected token was, let alone how to do all this. What have i done wrong? Thanks everyone. Plus any beginners tips would be nice!
var forwardSpeed : float = 3;
var turnspeed : float = 2;
Function; Update ();
- {
//this is the forward speed that will happen in the game
};var; forwardMoveAmount: Input.GetAxis("Vertical")*forwardSpeed;
var turnAmount = Input.GetAxis("Horizontal")*turnSpeed;
transform.Rotate(0,turnAmount,0);
}
Some beginner help as you asked. The unity3dstudent 'site has some 5-$$anonymous$$ute videos that explain alot of things with scripting and components. The last 2 links are for more tutorials =]
Start at the bottom and work up : http://www.unity3dstudent.com/category/modules/essential-skills/
Start at the bottom and work up : http://www.unity3dstudent.com/category/modules/beginner/
the Unity Wiki : http://wiki.unity3d.com/index.php/Tutorials
A list of resources : http://answers.unity3d.com/questions/12321/how-can-i-start-learning-unity-fast-list-of-tutori.html
Answer by PProductions · Sep 04, 2012 at 02:56 PM
Here is what the script should look like based on my knowledge:
var forwardSpeed : float = 3;
var turnspeed : float = 2;
function Update () {
//this is the forward speed that will happen in the game
var forwardMoveAmount = Input.GetAxis("Vertical")*forwardSpeed;
var turnAmount = Input.GetAxis("Horizontal")*turnSpeed;
transform.Rotate(0,turnAmount,0);
}
Hi, thanks for the tips alucardj, and PProductions, thanks i made the changes neccesary to look like the script you gave me, and that took away the unexpected tokens, but now I have turnspeed as an unknown identifier. Any idea how i can fix it? Thanks.
Pay attention to spelling/capitalization, it's extremely important in coding.
Eric5h5 thank you so much! It was the capital S in speed, and after i changed it, the error disappeared. Thanks!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Unity error "scripts exist in multiple locations" 1 Answer
Help Solve This 2 Answers
my script says OnCollisionEnter() error bce005 and it wont work 3 Answers
Spawn Script Issue 0 Answers