1. Format your code (the button with ones and zeroes).
2. Transform is a class name, not an object of that class - and that is what you need. Consider code below.
var speed = 3.0;
var crateprefab:Transform;
function Update() { if(Input.GetButtonDown("fire1")) {
var crate = Instantiate(crateprefab,transform.position,Quaternion.identity);
crate.Rigidbody.Addforce(Transform.forward *2000); }
}
The difference here is that transform (notice the small first letter) is a specific transform, used for the object you attach the script to.
↧