How to get bounds of orthographic camera in Unity?

In Unity, the rectangle bounds of a orthographic camera isn’t given directly. However, with certain calculation, it is possible to obtain it.

Suppose we have a orthographic camera called camera, then its bounds will be(C#):

float xBounds = camera.aspect * camera.orthographicSize * 2f;
float yBounds = camera * orthographicSize * 2f;

Tagged: , ,

Leave a comment

Your email address will not be published. Required fields are marked *