I have a box collider 2D with tag “Collider” which has isTrigger = true and in my player object I have a rigidbody 2d and a box collider 2d.
the code below is within a script within my player object
Now the onTriggerExit2d runs the first time just fine same as the enter but if i try to exit and enter the object again this code doesn’t run and i don’t know why this is.
void OnTriggerExit2D(Collider2D hit)
{
print("Collider Exit");
if(hit.gameObject.tag == "Collider")
{
print("Left Collider");
}
}
void OnTriggerEnter2D(Collider2D hit)
{
print("Triggered Entered");
if(hit.gameObject.tag == "Collider")
{
print("Entered Collider");
}
}
EDIT: Ok I was dumb it is working i just expected my console to write each line as it was told to and not stack matching prints ¬_¬ (I hadnt slept for 24 hours when i posted this)