OnTriggerExit2D not working, but OnTriggerEnter2D does???

Just as the title states. I have an enemy and when he collides with a boxCollider2D the OnTriggerEnter2D works, but I cant even get a Debug.Log(“test”); to show up on an OnTriggerExit2D.

What gives???

Check your spelling and capitalisation

If that doesnt help you might need to paste some code for anyone to be able to help

public void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == “Edge”)
{
enemy.ChangeDirection();

        }
        if (other.tag == "JumpTrigger")
        {
            enemy.EnemyJump();
            Debug.Log("Jump Test - On Enter");

        }
        if (other.tag == "LandTrigger")
        {
            enemy.EnemyLand();
            Debug.Log("Land test - On Enter");


        }
    }

    public void OnTriggerExit2D(Collider2D other)
    {
        if (other.tag == "JumpTrigger")
        {
            Debug.Log("Jump Test - On Exit");
        }
    }

On Enter works, On Exit does not.

???

It is soo hard to answer with such little information… :frowning:
There are soo many things to check.
1:Check which colliders are really used.
2:See if any colliders are getting Disabled/Becoming Non Trigger/Sizes/Changing Layers/ etc…
3:Check if one of at least one rigid body stays active all along.
4:Check if script is enabled all along. etc…

Sooo soo many things could have gone wrong.

Is your enemy actually leaving the the trigger area? if not, on trigger exit wont be called.

e.g. Enemy enters area, enemy is destroyed. Trigger exit wont be called.

e.g Enemy enters area, Trigger is destroy. Trigger exit wont be called.

e.g Enemy enters area, Passes through and out of area. Trigger exit will be called.

Try to change the place of " Debug.Log(“Jump Test - On Exit”);" to outside of your if condition [if (other.tag == “JumpTrigger”)] to see if the problem is really if the OnTriggerExit2D call or it is up to your IF statement