Pass nothing inside OnTriggerEnter2D(Collider2D other)
Hi,
Was wondering if there is anyway to put a form of if nothing is hit statement into OnTriggerEnter2D(Collider2D other), currently, this is my code
if (other.gameObject.tag == "Player")
{
other.gameObject.GetComponent<Player>().HurtPlayer(damageToGive);
Destroy(gameObject);
//If nothing is hit then destroy the gameobject here
}
Thanks for the help :)
Comment
But doesn't onTriggerEnter happen only when it is hit by another collider, not continuously? Do you mean that if the object is not being hit by anything, do something?