docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class CameraExtensions

    Extension methods for Camera components.

    Inheritance
    object
    CameraExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.XR.CoreUtils
    Assembly: Unity.XR.CoreUtils.dll
    Syntax
    public static class CameraExtensions

    Methods

    GetHorizontalFieldOfView(Camera)

    Calculates the horizontal field of view of the Camera.

    Declaration
    public static float GetHorizontalFieldOfView(this Camera camera)
    Parameters
    Type Name Description
    Camera camera

    The camera to get the aspect ratio and vertical field of view from.

    Returns
    Type Description
    float

    The horizontal field of view of the camera.

    GetVerticalFieldOfView(Camera, float)

    Calculates the vertical field of view from an aspect neutral (diagonal) field of view and the camera's aspect ratio.

    Declaration
    public static float GetVerticalFieldOfView(this Camera camera, float aspectNeutralFieldOfView)
    Parameters
    Type Name Description
    Camera camera

    The camera to get the aspect ratio from.

    float aspectNeutralFieldOfView

    The "aspect neutral" field of view, which is the diagonal field of view.

    Returns
    Type Description
    float

    The vertical field of view calculated.

    Remarks

    The field of view property of a Unity Camera stores the vertical field of view.

    GetVerticalOrthographicSize(Camera, float)

    Calculates the vertical orthographic size for a Camera and a given diagonal size.

    Declaration
    public static float GetVerticalOrthographicSize(this Camera camera, float size)
    Parameters
    Type Name Description
    Camera camera

    The camera to get the aspect ratio from.

    float size

    The diagonal orthographic size.

    Returns
    Type Description
    float

    The vertical orthographic size calculated.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)