Will PolygonCollider2D detect collision on the z axis?

I am making a birds eye view game with sprites. as my character moves down, his z axis increases, so that objects further down will draw over objects further up. can I use a polygonCollider2D so my character cannot walk through trees and such and he moves down? or should I just use a polygonCollider, my character is currently a sprite object, How does a polygonCollider work on a 2D sprite? Thanks for the help and direction.

The Collider2D uses a Vector2 rather than a Vector3. So for 2D collision, only the X and Y matter. ‘Z’ is ignored. So the different depths you are giving sprites will not impact collisions. That means your ‘trees’ are going to report a collision no matter how far the character is away on the ‘z’ axis. If you want to consider ‘z’ as your character moves down with 2D colliders you will have to play some potentially ugly games. How ugly will depend on how you are moving your character. 3D colliders and collisions will work, but you will not get the benefit of tight polygon colliders on sprites.