AceLand Unity Packages
  • Home
  • Getting Started
    • Installation
    • Project Settings
    • Architecture Graph
    • Development Level
  • Tutorial
    • Create Your Package
    • Create Project Settings
  • Packages
    • Library
      • Change Log
      • Editor Tools
      • Mono
        • Follow Object
        • Singleton
      • Attributes
        • Conditional Show
        • Inspector Button
        • ReadOnly Field
      • Build Leveling
      • CVS
      • DataTools
      • Disposable Object
      • Extensions
      • Json
      • Kalman Filter
      • Optional
      • Project Setting
      • Serialization Surrogate
      • Utils
    • Event Driven
      • Change Log
      • Event Bus
      • Signal
    • Input
      • Change Log
    • Memento Service
      • Change Log
    • Node Framework
      • Change Log
      • Mono Node
    • Node For Mono (dev)
    • Player Loop Hack
      • Change Log
    • Pool
      • Change Log
    • Security (dev)
    • States
      • Change Log
    • Task Utils
      • Change Log
    • WebRequest
      • Change Log
Powered by GitBook
On this page
  • In One Line
  • Overview
  • Package Info
  • How It Works
  • Why Use It
  • Project Settings
  • Getting Start
  • Usage Examples
  • UI Button (experimental)
  • GamePad Input Provider
  • Best Practices
  • Common Pitfalls
  1. Packages

Input

A streamlined event-driven input management solution that seamlessly integrates with Unity's Input System, allowing for quick setup and zero-code implementation.

In One Line

Input wizardry: Easy to code, amazing to play.

Overview

AceLand Input simplifies input handling in Unity projects by providing an automatic event-driven architecture built on top of Unity's Input System. It manages button states, axis inputs, and input mapping while eliminating the need for repetitive input handling code across different objects.

Package Info

display name

AceLand Input

package name

latest version

1.0.12

namespace

git repository

dependencies

How It Works

The system bootstraps automatically and processes input through three main channels:

  • Button Input: Handles press, hold, and release states with configurable timing

  • Axis Input: Manages single-axis values (like triggers)

  • Axis2 Input: Handles 2D inputs (like joysticks)

All input processing is managed through a central InputManager that distributes events to listening objects based on Unity's Input Action Maps. The system automatically handles common input patterns like hold detection, multi-tap recognition, and smooth analog input processing.

This package requires EventBus in AceLand Event Driven from v1.0.18

This package requires Unity Input System.


Why Use It

  • Zero-Code Setup: Configure inputs through Unity's Input Action Maps and connect them to objects through events

  • Automatic State Management: Built-in handling of common input states (press, hold, release)

  • Event-Driven Architecture: Clean separation of input handling from game logic

  • Enhanced Features: Built-in cursor management, UI interaction detection, and gamepad support

  • Flexible Integration: Works alongside existing input systems and can be extended with custom providers

  • Completed Event Data: Input Data set passing to listeners that providing action name, raw data, provided data, last data, event time.

Project Settings

Settings

---

Manager Loop State

Input Manager Loop State. Default: Time Update (Recommended)

Input Loop State

Input Event Loop State. Default: Initialization (Recommended)

Action Asset

Unity Input Action Asset. Package will use the action map in asset to present events.

Key Name Separate Char

** need verify

Cursor

---

Show Win Cursor

Show or hide OS cursor. Default: true

Cursor Lock Level

Which build level start to lock cursor. Default: Development

Lock Mode

None: do not lock Locked: cursor will locked on screen center Confined: cursor will locked in application window, user cannot move the cursor outside your application. Default: Confined

Button Input

---

Handle Button Input

Wheather handle button event. Default: true

Button Action Map Name

Name of action map Default: ButtonInput

Release Type

ReleasedOrReleasedAsButton: either one of state ReleasedOnly: only Released Default: ReleasedOnly

Quit Key Level

Enable quit key on/below build level. Default: Development

Quit Key

Action Key of Quit. Default: PlayerQuit

Reload Key Level

Enable reload key on/below build level. Default: Development

Reload Key

Action Key of Reload. Default: PlayerReload

Axis Input

---

Handle Axis Input

Wheather handle single axis event. Default: true

Axis Action Map Name

Name of action map Default: AxisInput

Axis Button Threshold

Minimum amount to trigger pressed state. Default: -0.6

Axis Button Action Time

A delay time of pressed state. Default: 0.8 In UIAxisButton, visual effect of color will be changed before pressed. Set to 0 if you want to handle yourself.

Axis2 Input

---

Handle Axis2 Input

Wheather handle Axis2 event. Default: true

Axis2 Action Map Name

Name of action map Default: Axis2Input

Getting Start

  1. Create an Input Action Asset in Project window

  2. Assign your Input Action Asset to the project setting

  3. Configure your action maps for buttons, axes, and 2D inputs

Action Properties

  • Do NOT set Interactions or Processors. System will handle.

ButtonInput

  • Action Type: Button

  • Initial State Check: false

AxisInput

  • Action Type: Pass Through

  • Control Type: Axis

  • Initial State Check: false

Axis2Input

  • Action Type: Pass Through

  • Control Type: Vector 2

  • Initial State Check: false


Usage Examples

Button Input

// Implement interfaces to receive input events
public class PlayerController : MonoBehaviour
{
    // subscribe Listeners to Events
    private void OnEnable()
    {
        EventBus.Event<IButtonPressed>
            .WithListener<BtnStatus>(OnButtonPressed)
            .Listen();
        EventBus.Event<IButtonHold>
            .WithListener<BtnStatus>(OnButtonHold)
            .Listen();
    }
    
    // unsubscribe Listeners from Events
    private void OnDisable()
    {
        EventBus.Event<IButtonPressed>
            .Unlisten<BtnStatus>(OnButtonPressed);
        EventBus.Event<IButtonHold>
            .Unlisten<BtnStatus>(OnButtonHold);
    }
    
    // Called when button is pressed
    private void OnButtonPressed(object sender, BtnStatus status)
    {
        if (status.Name == "Jump")
            Jump();
    }

    // Called when button is held
    private void OnButtonHold(object sender, BtnStatus status)
    {
        if (status.Name == "Sprint")
            Sprint();
    }
}

Axis Input

// Handle 1D input like triggers
public class WeaponController : MonoBehaviour
{
    // Bind interfaces for events
    private void OnEnable()
    {
        EventBus.Event<IAxisInput>
            .WithListener<InputData<float>>(OnAxisInput)
            .Listen();
    }
    
    // Unbind interfaces
    private void OnDisable()
    {
        EventBus.Event<IAxisInput>
            .Unlisten<InputData<float>>(OnAxisInput);
    }
    
    private void OnAxisInput(object sender, InputData<float> data)
    {
        if (data.Name == "Trigger")
            SetWeaponPower(data.ProvidedData);
    }
}

2D Axis Input

// Handle 2D input like joysticks
public class MovementController : MonoBehaviourt
{
    // Bind interfaces for events
    private void OnEnable()
    {
        EventBus.Event<IAxis2Input>
            .WithListener<InputData<Vector2>>(OnAxis2Input)
            .Listen();
    }
    
    // Unbind interfaces
    private void OnDisable()
    {
        EventBus.Event<IAxis2Input>
            .Unlisten<InputData<Vector2>>(OnAxis2Input);
    }
    
    private void OnAxis2Input(object sender, InputData<Vector2> data)
    {
        if (data.Name == "Move")
            Move(data.ProvidedData);
    }
}

Custom Input Provider

// Add custom input processing
public class CustomGamepadProvider : Singleton<CustomGamepadProvider>
{
    [SerializeField] private float sensitivityMultiplier = 0.8f;

    private void OnEnable()
    {
        // import custom provider to handle specified input value
        InputProvider.Importer<Vector2>()
            .WithActionName("Move")
            .WithMethod(ProcessMovement)
            .Import();
    }
    
    private void OnDisable()
    {
        // remove provider on destroy
        InputProvider.Remove<Vector2>("Move");
    }

    private Vector2 ProcessMovement(Vector2 input)
    {
        // Apply custom processing to raw input
        return input * sensitivityMultiplier;
    }
}

UI Button (experimental)

The package provides two UI Buttons:

  • AceLand/Input/UI/Button (UIButton.cs)

  • AceLand/Input/UI/Axis Button (UIAxisButton.cs)

Buttons work as canvas button, but press event to package and trigger event. By setting Action Key in inspector, specified action will be triggered.

If action is not neccessary for other input device, no binding is necessary in input action map.

This is a game changer on UI interactable objects logics. In current usages, you must create a public action handle function and reference to UI Button component. By using our package, only a single action name in input action map is neccesary in the button component. Action handle component inherit suitable event interface(s), system will do all stuffs.

These are experimental components. Please consider as an sample.

This will be created as an component works with Canvas system.


GamePad Input Provider

The package provides one input provider:

  • AceLand/Input/Game Pad Input Provider (GamePadInputProvider.cs)

The GamePad Input Provider component addresses a common issue with analog stick input where rapid stick releases can cause unwanted value fluctuations (bouncing) around the center position. When a user quickly releases the stick from an extreme position (e.g., -1.0), the mechanical spring return can generate inconsistent values up to ±0.6, creating jerky or unstable behavior in your game.

This provider implements intelligent smoothing that maintains responsiveness during active input while eliminating unwanted bounce artifacts on release. It automatically handles deadzone mapping and provides separate smoothing values for movement and stopping states, ensuring both precise control and stable neutral positions.

Move Direction Type is not functional in this version.

This will be created to change the input value to either free direction, 4 direction or 8 direction.


Best Practices

  • Organize your Input Action Maps by input type (buttons, axes, 2D axes)

  • Use meaningful action names that reflect their function

  • Implement appropriate interfaces only where needed

  • Consider using input providers for complex input processing

  • Group related inputs in the same action map

  • Test input behavior across different devices and platforms

Common Pitfalls

  • Don't mix traditional Input System calls with AceLand Input

  • Ensure Input Action Asset is properly assigned in project setting

  • Check interface implementation when input events aren't received

  • Be mindful of input override states during UI interaction


Last updated 1 month ago

please read for details, and samples code in this page.

please read for details.

com.aceland.input
AceLand.Input
com.aceland.eventdriven: 1.0.20
com.aceland.library: 1.0.20
com.aceland.playerloophack: 1.0.7
com.aceland.taskutils: 1.0.9
com.unity.inputsystem: 1.10.0
this page
official document
https://github.com/parsue/com.aceland.input.git
Input Action Map