OnCollisionEnter2D not being called on entering new tile once already called.

the title basically explains the issue- it seems that when adjacent both have onCollisionEnter2D when the object moves across them it only detects the point of entry - it does not detect oncollisionexit2d, the tilemap in question does have tilemap collider2d, and is used by collider.


However i found this OnCollisionEnter only detects once - Questions & Answers - Unity Discussions

Which then had me go edit the tiles collision box in sprite editor’s physics shape, making it a px smaller so that there would be a no collision space in between the tiles - however it STILL does not get detected. I dont see why. Maybe the fact the sprite’s collider/rigidbody is more than 2px wide and it think its still in the same? But that shouldnt be it.

Here’s the code

void OnTriggerEnter2D(Collider2D col)
    {
        if (col.GetComponent<Player>())
        {

            int randNum = Random.RandomRange(0,100);
            Debug.Log(randNum);

            if (randNum >55) {
                Debug.Log("Enter Tile Working?");
                
                //code here
            }
        }
    }
void OnTriggerExit2D(Collider2D col)
    {
        if (col.GetComponent<Player>()) {
            // Nothing 
            Debug.Log("exited tile?");
        }
    }

Anyone have a fix?

Hi @fr0stsp1k3
I’ve tested your issue an it detects all collisions in my unity 2018 version.
I’ve attached the test project below:
[123910-test.zip|123910]