How can I raycast a flat mesh?

Ok. So I have a brand-new mesh generation system for a sandbox game. I started writing it so that it creates a mesh instead of individual sprites. I add a collider to it afterwards. However, I am having trouble wrapping my head around how to raycast it from the player to collide. I wrote a very nice player controller that worked fine with BoxCollider2D’s when the game was written in 2D, but after switching to mesh generation for performance improvement all my work seems to be redundant. I use raycasting because I find it much more reliable than the Unity2D physics system. The problem (at least I think) is using Physics2D.Raycast and RaycastHit2D. However, I tried just raycast and that didn’t work either. It is because I’m raycasting from a direction in which the mesh has no thickness. Hope this can all be settled, thanks in advance! :slight_smile:

if you use mesh you must use Physics.Raycast and define Ray ray.
Physics2D.Raycast belongs to sprites.