Hi guys, I am having an issue with a simple script.
I have a game object that when it has taken a certain amount of force it gets destroyed and replaced by another prefab.
But some of them are calling more than on prefab when others only call one, as they should.
public GameObject prefab;
public GameObject smoke;
void OnCollisionEnter(Collision col) {
if (col.relativeVelocity.magnitude > 1 ) {
Instantiate (prefab, transform.position, transform.rotation);
Instantiate (smoke, transform.position, transform.rotation);
Destroy (gameObject);
}
}
}
I am not sure why its causing this issue
Thanks guys for any help!