void DrawColliders() { foreach (var g in GameObject.FindObjectsOfType <GameObject>()) { var comp = g.GetComponent <Collider2D>(); if (comp == null) { continue; } var vertices = Collider2DEx.GetOutlineVertices(comp); for (int i = 0; i < vertices.Length; i++) { if (i == 0) { Debug.DrawLine(vertices[vertices.Length - 1], vertices[i], Color.green); } else { Debug.DrawLine(vertices[i - 1], vertices[i], Color.green); } } } }
public CollisionBody(Collider2D c) { collider = c; vertices = Collider2DEx.GetOutlineVertices(c); }