logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityPlayerInputSlots

    Unity implementation of player input slots management for tracking device assignments.
    Manages a collection of player slots with unique indices, device IDs, and optional layout information.
    Provides functionality for assigning, unassigning, and tracking active player input devices.

    Inheritance
    object
    UnityPlayerInputSlots
    Implements
    IPlayerInputSlots
    Namespace: Serenity.InputGateway.Infrastructure.Components
    Assembly: Serenity.UnityPlayerInput.Infrastructure.dll
    Syntax
    public class UnityPlayerInputSlots : MonoBehaviour, IPlayerInputSlots

    Constructors

    UnityPlayerInputSlots()

    Declaration
    public UnityPlayerInputSlots()

    Properties

    Current

    Declaration
    public IReadOnlyList<PlayerInputSlot> Current { get; }
    Property Value
    Type Description
    IReadOnlyList<PlayerInputSlot>

    Gets the current collection of assigned player input slots as a read-only list.

    Methods

    ClearAll()

    Clears all assigned slots.

    Declaration
    public void ClearAll()

    TryAssignNextFree(string, string)

    Tries to assign the given deviceId to the next free slot index. If layout is provided, it will be stored with the slot.

    Declaration
    public bool TryAssignNextFree(string deviceId, string layout = null)
    Parameters
    Type Name Description
    string deviceId

    The deviceId to assign. Must be non-null and not already assigned.

    string layout

    The layout to assign to the slot. Can be null.

    Returns
    Type Description
    bool

    Returns false if deviceId is null/empty or already assigned. If successful, returns true and adds the slot.

    TryUnassignByDevice(string)

    Tries to unassign the slot with the given deviceId. Returns true if found and removed, false otherwise.

    Declaration
    public bool TryUnassignByDevice(string deviceId)
    Parameters
    Type Name Description
    string deviceId
    Returns
    Type Description
    bool

    True if the slot was found and removed, false otherwise.

    Implements

    IPlayerInputSlots
    In this article
    © 2026 Serenity. All Rights Reserved