BCE0005 Unknown identifier issue

Got this script from a tutorial. Did everything he did in the video. Running Mac OSX Leppoard. Any thoughts??


You should go back and carefully review the tutorial vs. your code. Your code likely should be something like:

#pragma strict

var forwardSpeed : float = 500;
var turnSpeed : float = 3.0;

function Start () {


function Update () {
	var forwardMovementAmount = Input.GetAxis("Vertical") * forwardSpeed;
	var turnAmount = Input.GetAxis("Horizontal") * turnSpeed;
	rigidbody.AddRelativeForce(forwardMovementAmount, 0,0);

The main issue with your code was one of scope. You declare ‘forwardSpeed’ and ‘turnSpeed’ inside of Start(). That means that they will only ‘live’ inside Start() once Start() is done, the variables no longer exist. Look at my rewrite above. The variables are declared outside of Start().

Note that in Javascript, variables are public by default. This means that if you want to change these values after the script has been attached to a game object, you need to do it in the Inspector. Chances in the script will be ignored after the script is attached.