When I select the Camera object, I see the border-lines, the near clipping plane and the camera preview. I would like to see all of these things when I select another game object.

In other words, I would like to still see the lines from the position and rotation of the main camera, but while having another object.

I know it somehow works with a custom inspector, I also found some solutions which seemed close ("how to create an editor screenview" and "show camera preview"), but I couldn't get them to work.

How do I show the position and rotation lines of the camera, while having other game objects selected?


1 Answer 1


I don't know of a way to force the camera preview picture-in-picture overlay to always display. My best recommendation for that part would be to set that camera to render to the display, and then use the Game Window as your camera preview. You can arrange your workspace tabs so you can see both the scene view and game at the same time.

Duplicating the frustum cage you see in the scene when the camera is selected is fairly straightforward. Attach this script to each camera you want to see this way:

public class AlwaysCameraGizmo : MonoBehaviour {

    public Color color = Color.white;

    Camera _camera;
    static Vector3[] _frustumPoints = new Vector3[8];

    void OnDrawGizmos()
        if (_camera == null)
            _camera = GetComponent<Camera>();

        Gizmos.color = color;

        _frustumPoints[0] = _camera.ViewportToWorldPoint(new Vector3(0, 0, _camera.nearClipPlane));
        _frustumPoints[1] = _camera.ViewportToWorldPoint(new Vector3(1, 0, _camera.nearClipPlane));
        _frustumPoints[2] = _camera.ViewportToWorldPoint(new Vector3(1, 1, _camera.nearClipPlane));
        _frustumPoints[3] = _camera.ViewportToWorldPoint(new Vector3(0, 1, _camera.nearClipPlane));

        _frustumPoints[4] = _camera.ViewportToWorldPoint(new Vector3(0, 0, _camera.farClipPlane));
        _frustumPoints[5] = _camera.ViewportToWorldPoint(new Vector3(1, 0, _camera.farClipPlane));
        _frustumPoints[6] = _camera.ViewportToWorldPoint(new Vector3(1, 1, _camera.farClipPlane));
        _frustumPoints[7] = _camera.ViewportToWorldPoint(new Vector3(0, 1, _camera.farClipPlane));

        // Near
        Gizmos.DrawLine(_frustumPoints[0], _frustumPoints[1]);
        Gizmos.DrawLine(_frustumPoints[1], _frustumPoints[2]);
        Gizmos.DrawLine(_frustumPoints[2], _frustumPoints[3]);
        Gizmos.DrawLine(_frustumPoints[3], _frustumPoints[0]);

        // Far
        Gizmos.DrawLine(_frustumPoints[4], _frustumPoints[5]);
        Gizmos.DrawLine(_frustumPoints[5], _frustumPoints[6]);
        Gizmos.DrawLine(_frustumPoints[6], _frustumPoints[7]);
        Gizmos.DrawLine(_frustumPoints[7], _frustumPoints[4]);

        // Between
        Gizmos.DrawLine(_frustumPoints[0], _frustumPoints[4]);
        Gizmos.DrawLine(_frustumPoints[1], _frustumPoints[5]);
        Gizmos.DrawLine(_frustumPoints[2], _frustumPoints[6]);
        Gizmos.DrawLine(_frustumPoints[3], _frustumPoints[7]);

This just manually renders the bounding frame of the camera's frustum each time the Unity editor repaints its gizmos. You can customize the colour to keep track of multiple cameras in a scene.

  • \$\begingroup\$ As far as a "constant preview", this is what I use. I keep the camera window in the bottom right corner. Looks practically indifferant to the regular preview. \$\endgroup\$
    – Gnemlock
    Feb 12, 2017 at 5:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .