I get this error:
NullReferenceException: Object reference not set to an instance of an object Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args)
Here's my code
public var myspeed = 3.0;
public var cratePrefab:Transform;
function Update () {
//find out if fire button pressed
if(Input.GetButtonDown("Fire1"))
{
//Create the prefab
var crate = Instantiate (cratePrefab, transform.position, Quaternion.identity);
//add force to the prefab
crate.Rigidbody.AddForce(transform.forward * 2000);
}
}
What is wrong?