Skip to content

Documentation

NeKoRoSYS edited this page Aug 26, 2023 · 8 revisions

What is this?

It's a list of all the scripts that are a part of the NeKoRoSYS's Mobile Input Handling framework. It's not just a list of scripts though, for all these scripts also have sub-lists of information regarding their variables and methods.


Input Management

  • ControlButton
    • Implementation

    • Variables
      • ControlStick joystick: Assigned from UISettings through PlayerManager.
      • static class Instance: A singleton which makes it easy to access during runtime without caching the class reference into the scripts.
      • PlayerInputActions playerInputActions: C# class auto-generated by Unity's New Input System.
      • InputAction MoveAction: Controls for moving.
      • InputAction LookAction: Controls for looking.
      • InputAction JumpAction: Controls for jumping.
      • InputAction CrouchAction: Controls for crouching.
      • InputAction SprintAction: Controls for sprinting.
    • Initialization
      • void Awake(): Initializes the Instance singleton and creates a new instance of playerInputActions, then assigns all the listed InputActions.
    • Events
      • void OnEnable(): Enables the instance of playerInputActions.
      • void OnDisable(): Disables the instance of playerInputActions.
    • Example Usage:

    Vector2 moveInput = PlayerInput.Instance.MoveAction.ReadValue<Vector2>().normalized;
    playerManager.GetCharacterController().Move(new Vector3(moveInput.x, 0f, moveInput.y) * Time.deltaTime);

  • ControlButton
    • Implementation

    • Variables
      • ControlStick joystick: Assigned from UISettings through PlayerManager.
      • static class Instance: A singleton which makes it easy to access during runtime without caching the class reference into the scripts.
      • PlayerInputActions playerInputActions: C# class auto-generated by Unity's New Input System.
      • InputAction MoveAction: Controls for moving.
      • InputAction LookAction: Controls for looking.
      • InputAction JumpAction: Controls for jumping.
      • InputAction CrouchAction: Controls for crouching.
      • InputAction SprintAction: Controls for sprinting.
    • Initialization
      • void Awake(): Initializes the Instance singleton and creates a new instance of playerInputActions, then assigns all the listed InputActions.
    • Events
      • void OnEnable(): Enables the instance of playerInputActions.
      • void OnDisable(): Disables the instance of playerInputActions.
    • Example Usage:

    Vector2 moveInput = PlayerInput.Instance.MoveAction.ReadValue<Vector2>().normalized;
    playerManager.GetCharacterController().Move(new Vector3(moveInput.x, 0f, moveInput.y) * Time.deltaTime);
Clone this wiki locally