Cycle through each vertex of a Polygon Collider 2D?

At the start of a level, I want to attach something to the closest vertex of all nearby colliders. So I use Physics2d.OverlapCircleAll to get all nearby colliders, then I use a foreach loop to iterate through the colliders and a nested foreach loop within to cycle through the verticies of each collider, checking the distance within the 2nd loop.

However I don’t know how to cycle through the vertices that each collider2d consist of. If col is a polygonCollider2D, I thought it would either be col.poly.paths[0] or col.colliderInfo.verticies, but neither of those work. I realize that how to do this will vary depending on the collider, but right now I’m interested in the polygon collider.

Hey there, this should work for you.

void polyVertCycle(PolygonCollider2D col)
{
	Vector2[] points = col.points;

	for(int i = 0;i<points.Length ;i++)
	{
		points *= //do something with vector2*
  •   }*
    
  • }*
    EDIT: only saw the date after sending