AplosConsoleInputAdapterBase

AplosConsoleInputAdapterBase is an abstract MonoBehaviour base for implementing a custom input adapter. It implements IAplosConsoleInputAdapter, wiring Initialise up automatically and hooking HandleConsoleOpen/HandleConsoleClose into AplosConsole's open/close events on Start, then calling Dispose and unsubscribing on OnDestroy. Derive from it and implement the abstract members to bind your own input system to the console; the console's built-in UnityInputSystemAdapter is implemented the same way.

Inheritance
object
 ↳ Object
    ↳ Component
       ↳ Behaviour
          ↳ MonoBehaviour
             ↳ AplosConsoleInputAdapterBase


Inherited Members:

  • MonoBehaviour.IsInvoking()
  • MonoBehaviour.CancelInvoke()
  • MonoBehaviour.Invoke(string, float)
  • MonoBehaviour.InvokeRepeating(string, float, float)
  • MonoBehaviour.CancelInvoke(string)
  • MonoBehaviour.StartCoroutine(IEnumerator)
  • MonoBehaviour.StopCoroutine(Coroutine)
  • MonoBehaviour.StopAllCoroutines()
  • Behaviour.enabled
  • Component.gameObject
  • Component.transform
  • Object.name

Namespace: AplosConsole.Input
Implements: IAplosConsoleInputAdapter

Properties

Name Data Type Description
InputProvider IConsoleInputProvider The input provider passed to Initialise, set automatically on Start. Protected; get-only from derived classes.
PlayerInput PlayerInput The Unity Input System PlayerInput this adapter drives. Protected; get/set from derived classes.

Protected methods

Start

Example

protected override void Start()
{
    SetupPlayerInput();
    base.Start();
}

Description: Calls Initialise(AplosConsole.Instance) and subscribes HandleConsoleOpen/HandleConsoleClose to AplosConsole.OnOpenConsole/OnCloseConsole. Override to set up adapter-specific state first, then call base.Start() to preserve this wiring.


OnDestroy

Example

protected override void OnDestroy()
{
    base.OnDestroy();
}

Description: Calls Dispose() and unsubscribes HandleConsoleOpen/HandleConsoleClose from AplosConsole's open/close events. Override only for extra teardown, and call base.OnDestroy() to preserve this unsubscription.


Public methods

Initialise

Parameters:

Example

adapter.Initialise(AplosConsole.Instance);

Description: Stores inputProvider in InputProvider. Called automatically from Start; implements IAplosConsoleInputAdapter.Initialise.


HandleConsoleOpen

Example

public override void HandleConsoleOpen()
{
    if (PlayerInput == null) return;
    PlayerInput.SwitchCurrentActionMap("UI");
}

Description: Abstract. Override to react to the console opening, typically by switching or disabling gameplay input action maps.


HandleConsoleClose

Example

public override void HandleConsoleClose()
{
    if (PlayerInput == null) return;
    PlayerInput.SwitchCurrentActionMap(_previousActionMap);
}

Description: Abstract. Override to react to the console closing, typically by restoring the gameplay input action map.


Dispose

Example

public override void Dispose()
    => _currentInputBinding?.UnbindInput();

Description: Abstract. Override to release any resources or bindings the adapter holds. Called automatically from OnDestroy.