Unexpected token
Hey i am new to unity and i have created a script, for AI to follow player, and i have some problems with an error "Unexpected token", can someone help me , please
i have that error on number "20" and "5" this is the code :
#pragma strict
#pragma implicit
#pragma downcast
var target : Transform;
var Movespeed : 20;
var rotationspeed : 5;
var myTransform : Transform;
function Awake ()
{
myTransform = transform;
}
function Start ()
{
target = GameObject.FindWithTag("Player").transform;
}
function Update ()
{
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationspeed*Time.deltaTime);
myTransform.position +=myTransform.forward * Movespeed * Time.deltaTime;
}
thanks
Answer by Joebear · Dec 05, 2015 at 04:12 PM
I'm new so this may not be correct, but I had the same problem and fixed it this way: Unexpected token usually means that you have a lack of brackets somewhere. You could have to add an extra pair of brackets around a chunk of the text, or have a left bracket with no right bracket somewhere in your script, or vice versa. (Sorry for the late reply)
Your answer
Follow this Question
Related Questions
invalid token = in class, struct? 0 Answers
Unexpected symbol `1' ?? 1 Answer
Making a POST request to Google OAuth using WWWForms 1 Answer