Question by
saudkhan1391 · Aug 11, 2017 at 06:49 AM ·
destroyontriggerenter
ontriggerenter2D, Object is not destroyed on the first collision. Object is destroyed on the 2nd or 3rd collsion.
When the player hits the object, i need the object to be destroyed on the first collision.. Object is tagged with "20score".Object is destroyed on the 3rd or fourth collision.
Here is the code :
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "20score") { Destroy(GameObject.FindWithTag("20score")); x=x+20; }
Comment