- Home /
I have an error while building the game
I am trying to make a game in witch you shoot cubes from 1st person view and i'm using this script
var speed = 3.0;
var CratePrefab:Transform;
function Update ()
{
if(Input.GetButtonDown("Fire 1"))
{
var Crate = Instantiate( CratePrefab, transform.position, Quaternion.identity);
Crate.rigidbody.AddForce(transform , forward * 2000);
}
}
Then i get this error:
Assets/Shoot.js(11,54): BCE0005: Unknown identifier: 'forward'.
Answer by Tzan · Sep 23, 2010 at 02:53 AM
Is that comma supposed to be a period?
Crate.rigidbody.AddForce(transform.forward * 2000);
http://unity3d.com/support/documentation/ScriptReference/Rigidbody.AddForce.html
Upvoted because your code is correct, but the reason he's getting that specific error is because there are spaces between "transform" and "forward".
Your answer
Follow this Question
Related Questions
Can't compile script from Scripting Tutorial (translated to Boo) 3 Answers
I got a major question 1 Answer
jumping error!? 4 Answers
Unexpected Token: Collider. 1 Answer
What does BCE0004: Ambiguous reference error mean? 3 Answers