I’m trying to make an enemy fire a thing while it runs at you. It’s working pretty well, except when I try to remove the bullet after a while, it only removes the object’s rigidbody. Here’s the script I have right now:
var spit:Rigidbody;
function Spit()
{
var SpitClone = Instantiate(spit, transform.position, transform.rotation);
SpitClone.velocity = transform.TransformDirection(Vector3.forward * 10);
Physics.IgnoreCollision(SpitClone.collider, collider);
Destroy(SpitClone, 10);
}
How can I destroy the whole GameObject?