Skip to content

Instantly share code, notes, and snippets.

@elebetsamer
Last active May 5, 2021 19:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save elebetsamer/9206403 to your computer and use it in GitHub Desktop.
Save elebetsamer/9206403 to your computer and use it in GitHub Desktop.
View the bounds of an orthographic camera in Unity even if it isn't selected.
void OnDrawGizmos()
{
float verticalHeightSeen = Camera.main.orthographicSize * 2.0f;
float verticalWidthSeen = verticalHeightSeen * Camera.main.aspect;
Gizmos.color = Color.cyan;
Gizmos.DrawWireCube(transform.position, new Vector3(verticalWidthSeen, verticalHeightSeen, 0));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment