Question by
shazzer9 · Nov 01, 2016 at 07:04 PM ·
destroyontriggerenterif-statementsclasses
hey im wondering how to destroy an object after a certain score... its a 'wall' but i want it be destroyed after say 100 but it seems to be destroyed every time i touch it with the player any help at all would be appreciated.... heres what i have
public class DestroyWall : MonoBehaviour { public GameController scoreScript;
void OnTriggerEnter(Collider other)
{
if (scoreScript.score >= 110)
{
Destroy(other.gameObject);
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612095835im_/https://answers.unity.com/themes/thub/images/avi.jpg)