logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityPrimaryInputPromptView

    Unity implementation of primary input prompt view that handles initial player device detection and assignment.
    Provides two operational modes: gate-based detection using injected IPrimaryInputGate and self-armed detection using Unity Input System callbacks.
    Manages device pairing, control scheme switching, and player input routing for establishing the primary player interface.

    Inheritance
    object
    UnityUiView
    UnityPrimaryInputPromptView
    Implements
    IPrimaryInputPromptView
    IViewBase
    IFoundationSettings
    Inherited Members
    UnityUiView._viewModel
    UnityUiView._wrapper
    UnityUiView._useCases
    UnityUiView._audioClips
    UnityUiView._audioPlayerPlayClip
    UnityUiView._audioServiceId
    UnityUiView._eventDispatcherService
    UnityUiView._uiShowSfxKey
    UnityUiView._uiHideSfxKey
    UnityUiView.Initialize(AudioPlayerPlayClip, string, IEventDispatcherService)
    UnityUiView.InitializeEventDispatcher(IEventDispatcherService)
    UnityUiView.SetEventDispatcherService(IEventDispatcherService)
    UnityUiView.SetWrapper(GameObject)
    UnityUiView.GetWrapper()
    UnityUiView.SetViewModel(UnityUiViewModel)
    UnityUiView.GetViewModel()
    UnityUiView.GetUseCases()
    UnityUiView.GetAudioClips()
    UnityUiView.SetAudioServiceId(string)
    UnityUiView.SetAudioClips(AudioPlayerClip, AudioPlayerClip)
    UnityUiView.SetAudioPlayerPlayClip(AudioPlayerPlayClip)
    UnityUiView.SetUseCases(UiUseCases)
    UnityUiView.OnShow(bool)
    UnityUiView.OnDraggingStart()
    UnityUiView.DisableNonSelectedButtons()
    UnityUiView.OnDraggingEnd()
    UnityUiView.EnableAllButtons()
    UnityUiView.CanPlayAudio(string)
    Namespace: Serenity.Ui.Infrastructure.Views
    Assembly: Serenity.UnityUi.Infrastructure.dll
    Syntax
    public class UnityPrimaryInputPromptView : UnityUiView, IPrimaryInputPromptView, IViewBase, IFoundationSettings

    Constructors

    UnityPrimaryInputPromptView()

    Declaration
    public UnityPrimaryInputPromptView()

    Methods

    ArmAndAwait(CancellationToken)

    Arms the input detection system and begins waiting for primary device input.
    Selects between gate-based detection or self-armed detection based on available dependencies.
    Manages cancellation tokens and cleanup for proper async operation lifecycle.

    Declaration
    public void ArmAndAwait(CancellationToken externalCt)
    Parameters
    Type Name Description
    CancellationToken externalCt

    External cancellation token for operation control

    Initialize(PlayerInput, IPrimaryInputGate, IUiInputRouter, IViewModel, IFoundationViewElement)

    Initializes the primary input prompt view with required dependencies and configuration.
    Sets up player input, input gate, UI router, view model, and wrapper elements for proper operation.
    Establishes the foundation for device detection and primary player assignment functionality.

    Declaration
    public void Initialize(PlayerInput playerInput, IPrimaryInputGate gate, IUiInputRouter router, IViewModel viewModel, IFoundationViewElement wrapper)
    Parameters
    Type Name Description
    PlayerInput playerInput

    The Unity PlayerInput component for device management

    IPrimaryInputGate gate

    The input gate interface for device detection (optional)

    IUiInputRouter router

    The UI input router for restricting input to primary device

    IViewModel viewModel

    The view model for UI state management

    IFoundationViewElement wrapper

    The wrapper element containing the visual prompt UI

    OnDestroy()

    Unity lifecycle method called when the component is destroyed.
    Performs final cleanup including cancellation token disposal and listener removal.
    Ensures complete resource cleanup on component destruction.

    Declaration
    protected override void OnDestroy()

    SubscribeToEventDispatcherEvents()

    Abstract method implementation for event dispatcher subscription.
    Currently empty as this view handles input detection independently of the main event system.

    Declaration
    public override void SubscribeToEventDispatcherEvents()
    Overrides
    UnityUiView.SubscribeToEventDispatcherEvents()

    WireDependencies(UnityPrimaryInputGate, UnityUiInputRouter)

    Wires concrete Unity components for the gate and router onto this view and marks it initialized. Use this from installers after hierarchy wiring so serialized references and runtime interfaces are both set.

    Declaration
    public void WireDependencies(UnityPrimaryInputGate gate, UnityUiInputRouter router)
    Parameters
    Type Name Description
    UnityPrimaryInputGate gate

    Concrete UnityPrimaryInputGate component (may be null)

    UnityUiInputRouter router

    Concrete UnityUiInputRouter component (may be null)

    Events

    OnPrimarySelected

    Event triggered when a primary input device is successfully detected and configured.
    Provides the selected device's control scheme, device ID, and display name for system integration.

    Declaration
    public event Action<(string scheme, string deviceId, string displayName)> OnPrimarySelected
    Event Type
    Type Description
    Action<(string scheme, string deviceId, string displayName)>

    Implements

    IPrimaryInputPromptView
    IViewBase
    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved