Example #1
0
    void OnDrawGizmos() {
      if (Application.isPlaying) return;

      body = GetComponent<PolygonCollider2D>();
      Vector3 size = body.bounds.size;
      Vector3 pos = transform.position;

      Handles.Label(pos + new Vector3(-size.x * 0.5f, size.y * 0.5f, 0), "Fence");

      Handles.color = new Color(1, 1, 0, 0.05f);
      Handles.DrawAAConvexPolygon(body.GetWorldPoints3());
    }