I'm trying to draw a square using loops but no success so far.
This is one of my many attempts:
for (int i = 0; i < 1; i++) {
Vector2 start = new Vector2 (collider.bounds.min.x + (collider.bounds.size.x * i), collider.bounds.min.y);
for (int j = 0; j < 1; j++) {
Vector2 end = new Vector2 (collider.bounds.min.x, collider.bounds.min.y + (collider.bounds.size.y * j));
RaycastHit2D hit = Physics2D.Linecast (start, end, obstacleLayer);
Debug.DrawLine (start, end, Color.red, 10.0f);
}
}[
↧