Okay, so my fire script is this;
var projectile : Transform;
var bulletSpeed : int = 1000;
function Update ()
{
var fireBall = GameObject.Find("spawnPoint");
// Put this in your update function
if (Input.GetMouseButtonDown(0)) {
// Instantiate the projectile at the position and rotation of this transform
var clone : Transform;
clone = Instantiate(projectile, fireBall.transform.position, transform.rotation);
// Add force to the cloned object in the object's forward direction
clone.rigidbody.AddForce(clone.transform.forward * bulletSpeed);
}
Destroy(clone.gameObject, 5);
}
This actually instantiates a clone, however the line
Destroy(clone.gameObject, 5);
Returns object cannot be set to an instance? I have no idea why it returns that. I’ve even referenced it to clone.gameObject as it couldn’t convert unity.engine transform into w/e.
Any suggestions?