|
@ -58,18 +58,33 @@ public static class DebugExtensions |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Draws wireframe around a RectTransform in scene view
|
|
|
/// Draws wireframe around a RectTransform in scene view
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="transform">Rect transform to draw around</param>
|
|
|
|
|
|
|
|
|
/// <param name="rect">Rect to draw around</param>
|
|
|
/// <param name="color">Color of the lines</param>
|
|
|
/// <param name="color">Color of the lines</param>
|
|
|
/// <param name="duration">How long the lines should be visible for</param>
|
|
|
/// <param name="duration">How long the lines should be visible for</param>
|
|
|
/// <param name="depthTest">Should the lines be obscured by objects closer to the camera</param>
|
|
|
/// <param name="depthTest">Should the lines be obscured by objects closer to the camera</param>
|
|
|
public static void DrawRect(RectTransform transform, Color color, float duration = 0.0f, bool depthTest = false) |
|
|
|
|
|
|
|
|
public static void DrawRect(Rect rect, Color color, float duration = 0.0f, bool depthTest = false) |
|
|
{ |
|
|
{ |
|
|
Rect rect = transform.GlobalRect(); |
|
|
|
|
|
|
|
|
|
|
|
Debug.DrawLine(new Vector3(rect.min.x, rect.max.y, 0), new Vector3(rect.max.x, rect.max.y, 0), color, duration, depthTest); |
|
|
Debug.DrawLine(new Vector3(rect.min.x, rect.max.y, 0), new Vector3(rect.max.x, rect.max.y, 0), color, duration, depthTest); |
|
|
Debug.DrawLine(new Vector3(rect.max.x, rect.max.y, 0), new Vector3(rect.max.x, rect.min.y, 0), color, duration, depthTest); |
|
|
Debug.DrawLine(new Vector3(rect.max.x, rect.max.y, 0), new Vector3(rect.max.x, rect.min.y, 0), color, duration, depthTest); |
|
|
Debug.DrawLine(new Vector3(rect.max.x, rect.min.y, 0), new Vector3(rect.min.x, rect.min.y, 0), color, duration, depthTest); |
|
|
Debug.DrawLine(new Vector3(rect.max.x, rect.min.y, 0), new Vector3(rect.min.x, rect.min.y, 0), color, duration, depthTest); |
|
|
Debug.DrawLine(new Vector3(rect.min.x, rect.min.y, 0), new Vector3(rect.min.x, rect.max.y, 0), color, duration, depthTest); |
|
|
Debug.DrawLine(new Vector3(rect.min.x, rect.min.y, 0), new Vector3(rect.min.x, rect.max.y, 0), color, duration, depthTest); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Draws wireframe around a RectTransform in scene view
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="transform">Rect transform to draw around</param>
|
|
|
|
|
|
/// <param name="color">Color of the lines</param>
|
|
|
|
|
|
/// <param name="duration">How long the lines should be visible for</param>
|
|
|
|
|
|
/// <param name="depthTest">Should the lines be obscured by objects closer to the camera</param>
|
|
|
|
|
|
public static void DrawRect(RectTransform transform, Color color, float duration = 0.0f, bool depthTest = false) |
|
|
|
|
|
{ |
|
|
|
|
|
Rect rect = transform.GlobalRect(); |
|
|
|
|
|
|
|
|
|
|
|
DrawRect(rect, color, duration, depthTest); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}//End DebugExtentions
|
|
|
}//End DebugExtentions
|