Trying to destroy a bullet but it freezes! (JS)

Hey there,
I’ve been trying to create a projectile which gets destroyed after a set amount of time. The problem I’m having is that the bullet freezes when it should be destroyed. I’m using prefabs to create the instances.

Here is the code I used, I apologise if not all of it is relevant:

BulletMaker.js

var bullet : Rigidbody;
var speed : float = 500.0f;

function Update () {
	if (Input.GetMouseButtonDown(0))	
	{
		var latestBullet = Instantiate(bullet, this.transform.position, transform.rotation);
		latestBullet.AddRelativeForce(Vector3.forward * speed);
		Destroy (latestBullet, 0.2f);
		Debug.Log("Destroy");
	}	
}

Below is an image depicting what happens, though I understand that a still image doesn’t really capture everything.
55447-ss2015-10-03at010915.jpg

you need to Destroy(latestBullet.gameObject,0.2f);

because your code is just deleting the rigidbody from the prefab, while leaving everything else like the mesh renderer in place :slight_smile: