logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Interface IUiMouseInteractionLock

    Interface for managing mouse/pointer interaction locks in the UI system.
    Used to temporarily disable pointer input to UI elements (except the active owner) while maintaining keyboard navigation.
    Tracks ownership so that when locked, only the owner's hierarchy receives pointer events.

    Owners and targets are typed object because the Application layer must not reference the engine's scene-graph types (e.g. Unity's GameObject/Transform); they are opaque tokens compared by reference identity. The concrete engine implementation casts to its native types to perform hierarchy checks. See IUiThemeComponents for the same pattern applied to engine asset references.

    Namespace: Serenity.Ui.Application.Interfaces
    Assembly: Serenity.Ui.Application.dll
    Syntax
    public interface IUiMouseInteractionLock

    Properties

    ActiveOwner

    Gets the current lock owner's token, or null if not locked.

    Declaration
    object ActiveOwner { get; }
    Property Value
    Type Description
    object

    IsLocked

    Gets whether mouse interaction is currently locked.

    Declaration
    bool IsLocked { get; }
    Property Value
    Type Description
    bool

    Methods

    ForceUnlockAll()

    Forces release of all mouse interaction locks regardless of owner.
    Use for emergency cleanup scenarios.

    Declaration
    void ForceUnlockAll()

    ForceUnlockOwnedBy(object)

    Forces release of all mouse interaction locks owned by the specified owner.
    Use for cleanup scenarios like component destruction or error recovery.

    Declaration
    void ForceUnlockOwnedBy(object owner)
    Parameters
    Type Name Description
    object owner

    The token to release locks for.

    IsPointerAllowedFor(object)

    Checks if a given target is allowed to receive pointer events.
    Returns true if not locked, or if the target is part of the active owner's hierarchy.

    Declaration
    bool IsPointerAllowedFor(object target)
    Parameters
    Type Name Description
    object target

    The token (e.g. a Unity Transform) to check.

    Returns
    Type Description
    bool

    True if pointer events should be allowed for this target.

    Lock(object)

    Acquires a mouse interaction lock for the specified owner.
    While locked, only UI elements that are children of the owner's hierarchy will receive pointer events.
    If already locked by another owner, this call is ignored (first owner wins).

    Declaration
    void Lock(object owner)
    Parameters
    Type Name Description
    object owner

    The token (e.g. the input component's root GameObject) that owns the lock.

    Unlock(object)

    Releases the mouse interaction lock for the specified owner.
    Only the current owner can release the lock. Other callers are ignored.

    Declaration
    void Unlock(object owner)
    Parameters
    Type Name Description
    object owner

    The token that owns the lock.

    In this article
    © 2026 Serenity. All Rights Reserved