I am having some trouble with 2Dcollision. I have a player and a moving obstacle. They both have an edge collider, and my obstacle has a ridgibody too (all 2D versions).
I am trying to destroy the obsticle and reduce lives total by one every time i colide with an enemy.
Your codes look fine.You should check if trigger checkbox checked in the inspector for your collider and if it doesnt change you should change edge collider if my memory serves well i had alot of issues with edge collider once.
Just in case the OnCollisionEnter2D, for whatever reason doesn’t register, like fast moving objects. For very fast moving object, it may help to use a RayCast2D to detect Collisions.