Not too many words to this. I was searching for quick solution to draw a debug rectangle (ok many rectangles for pathfinding debugging) in Unity3D and found nothing on the internet.
Its as easy as follows:
void DebugDrawColoredRectangle(Vector3 position, float size, Color color)
{
Debug.DrawLine(position, new Vector3(position.x + size, position.y, position.z), color);
Debug.DrawLine(position, new Vector3(position.x, position.y – size, position.z), color);
Debug.DrawLine(new Vector3(position.x, position.y – size, position.z), new Vector3(position.x + size, position.y – size, position.z), color);
Debug.DrawLine(new Vector3(position.x + size, position.y – size, position.z), new Vector3(position.x + size, position.y, position.z), color);
}
Just copy and paste this code and call it with
this.DebugDrawColoredRectangle(Vector3.zero, 1, Color.red);
Thats it. Hope it helps someone to save time.