void OnEnable() { rb = (RoundedBoxCollider2D)target; edgeCollider = rb.GetComponent<EdgeCollider2D>(); if (edgeCollider == null) { rb.gameObject.AddComponent<EdgeCollider2D>(); edgeCollider = rb.GetComponent<EdgeCollider2D>(); } edgeCollider.points = rb.getPoints(edgeCollider.offset); }
void OnEnable() { rb = (RoundedBoxCollider2D)target; edgeCollider = rb.GetComponent <EdgeCollider2D>(); if (edgeCollider == null) { rb.gameObject.AddComponent <EdgeCollider2D>(); edgeCollider = rb.GetComponent <EdgeCollider2D>(); } Vector2[] pts = rb.getPoints(edgeCollider.offset); if (pts != null) { edgeCollider.points = pts; } }
void OnEnable() { rb = (RoundedBoxCollider2D)target; polyCollider = rb.GetComponent <PolygonCollider2D>(); if (polyCollider == null) { polyCollider = rb.gameObject.AddComponent <PolygonCollider2D>(); } Vector2[] pts = rb.getPoints(); if (pts != null) { polyCollider.points = pts; } }