Sorry I should’ve been more clear. You can add the destroy line in a few places. Either in the Start function as such:
void Start ()
{
Destroy(gameObject, 5f);
}
or after the foreach loop in the explosions function like such:
void GrenadeExplosion ()
{
Vector3 explosionPos = transform.position;
Collider[] col = Physics.OverlapSphere (explosionPos, radius);
foreach (Collider obj in col)
{
if (obj && obj.attachedRigidbody)
obj.attachedRigidbody.AddExplosionForce (power, explosionPos, radius, liftPower);
}
Destroy (gameObject);
}
Note that in this case I just have it instantly destroyed once this function is called. So if I called that function from “OnCollisionEnter” it would then explode and destroy the grenade at the same time to create a more realistic effect. Hope that helps.