Class CameraUtils
Helpers for locating the camera that is currently drawing to the screen, without depending on a specific camera rig or tag.
Inherited Members
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 |