logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class CameraUtils

    Helpers for locating the camera that is currently drawing to the screen, without depending on a specific camera rig or tag.

    Inheritance
    object
    CameraUtils
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Shared.Utils
    Assembly: Serenity.Shared.dll
    Syntax
    public static class CameraUtils

    Methods

    ResolveActiveCamera()

    Resolves the active screen-rendering camera: the enabled camera with the highest UnityEngine.Camera.depth that draws to the screen, falling back to UnityEngine.Camera.main. Returns null when no camera exists.

    Camera.main alone is ambiguous when more than one camera is tagged "MainCamera" — which happens when gameplay loads additively on top of a persistent init scene that keeps its own MainCamera. UnityEngine.Camera.allCameras lists only enabled cameras and is always current, so re-resolving it picks up a newly-added camera automatically.

    Declaration
    public static Camera ResolveActiveCamera()
    Returns
    Type Description
    Camera
    In this article
    © 2026 Serenity. All Rights Reserved