Hello,
I’m working on a script that destroys a prefab object when it collides twice. Now my problem is, the DashBox is a tag on a prefab. It occurs often in one scene. But if I collide once with a DashBox and move my player to another DashBox in the scene and collide with it, the 2nd DashBox gets destroyed. Logically that makes sense, but this is not what I want. I cannot wrap my head around a answer for the solution, to solve this. Does anyone have an idea? Thanks.
and, in the ‘ScriptAssignedToDashBoxObject’ script:
function Update(){ //Or FixedUpdate, depends on your needs
if (life <= 0){
Die();
}
}
function Die(){
//here you can put all the logic derived from the death event.
//Like updating score, drop bonuses, etc...
Destroy(gameObject);
}