logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityGameCameraSwitchHolds

    Unity implementation of IGameCameraSwitchHolds: switches through the camera service's exclusive switch and counts the holds per switched UnityEngine.Camera, so a camera two volumes switched to is handed back once, when the last of them releases it.

    Inheritance
    object
    UnityGameCameraSwitchHolds
    Implements
    IGameCameraSwitchHolds
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.GameCamera.Infrastructure.Services
    Assembly: Serenity.UnityGameCamera.Infrastructure.dll
    Syntax
    public class UnityGameCameraSwitchHolds : IGameCameraSwitchHolds
    Remarks

    Taking the first hold turns the camera on and registers it with the service; releasing the last one — when the releaser asks to restore — makes the camera that was active before the first hold active again, and hands back a camera the service did not know before unregistered and on or off as the scene had it. A camera the service already knew (one with a Game Camera Binder) stays the service's to manage. If another camera became active while the hold was in effect, the last release leaves that camera active. A switched camera destroyed while held is simply forgotten on release.

    A camera's record lives until the camera is handed back. A last release that does not restore leaves the camera switched, so its record stays, with no holders, still carrying what the first switch found: the next hold on the same camera reuses it, and handing back later still returns the target as the scene had it and makes the camera active before the first switch active again. If another camera became active in the meantime, that choice replaces the camera to restore when the next hold is taken — the player saw it last, so it is what comes back — while the target's own facts are kept.

    Constructors

    UnityGameCameraSwitchHolds(IGameCameraService)

    Creates the holds record switching through cameraService.

    Declaration
    public UnityGameCameraSwitchHolds(IGameCameraService cameraService)
    Parameters
    Type Name Description
    IGameCameraService cameraService

    The camera service whose exclusive switch does the switching.

    Methods

    Acquire(object)

    Declaration
    public void Acquire(object targetCamera)
    Parameters
    Type Name Description
    object targetCamera

    Release(object, bool)

    Declaration
    public void Release(object targetCamera, bool restorePrevious)
    Parameters
    Type Name Description
    object targetCamera
    bool restorePrevious

    Implements

    IGameCameraSwitchHolds
    In this article
    © 2026 Serenity. All Rights Reserved