API Documentation
The API is fully event-driven and allows you to listen to gestures or combo step executions without modifying internal logic. To use the API, make sure to include:
using NewInputSystemPro.GestureCombo;
1. Gesture Combo Manager API
Use this API to respond to completed combo steps. You can also query the last triggered combo.
Events
public static event Action<GestureComboIdentifier, string, string> OnExecutedStep;
- GestureComboIdentifier: Identifies the manager instance
- string comboName: The triggered combo name
- string stepName: The executed step name
Public Methods
public static string GetLastExecutedInfo(GestureComboIdentifier id)
Returns the last executed combo/step for the given manager.
public static void ReportExecutedStep(GestureComboIdentifier id, string comboName, string stepName)
Internal method. Do not call this manually.
2. Gesture Output API
Use this API to listen for raw gesture input (tap, swipe, hold, pinch, rotation), even without combos.
Touch Gesture Events (Single-Finger)
public static event Action<TouchIdentifier> OnTap; public static event Action<TouchIdentifier> OnHoldStart; public static event Action<TouchIdentifier> OnHoldEnd; public static event Action<TouchIdentifier> OnSwipeLeft; public static event Action<TouchIdentifier> OnSwipeRight; public static event Action<TouchIdentifier> OnSwipeUp; public static event Action<TouchIdentifier> OnSwipeDown;
Multi-Touch Gesture Events (Two-Finger)
public static event Action<MultitouchIdentifier, float> OnPinchIn; public static event Action<MultitouchIdentifier, float> OnPinchOut; public static event Action<MultitouchIdentifier, float> OnRotationLeft; public static event Action<MultitouchIdentifier, float> OnRotationRight;
Sensitivity Properties
public static float RotationSensitivity { get; set; } = 1.0f; public static float ZoomSensitivity { get; set; } = 1.0f;
Adjust these to scale the output values for pinch and rotation.
3. New Input System Proevent API
Use this to switch the active GestureComboManager
at runtime using events – ideal for UI-based switching.
Events
public static event Action<TouchIdentifier, int> OnTouchComboManagerSwitch; public static event Action<MultitouchIdentifier, int> OnMultitouchComboManagerSwitch;
Usage Example
NewInputSystemProeventAPI.OnTouchComboManagerSwitch?.Invoke(touchID, 0); NewInputSystemProeventAPI.OnMultitouchComboManagerSwitch?.Invoke(multitouchID, 1);
Best Practices
- Always subscribe/unsubscribe in
OnEnable()
andOnDisable()
- Use unique identifiers for all gesture input components
- Only use switch/trigger methods manually if you're building custom gesture logic
Joystick API Documentation
The JoystickOutputAPI provides event-based access to touch joystick input. You can respond to movement, press and release events across multiple joystick instances. To use the API, include:
using NewInputSystemPro.Joystick;
JoystickOutputAPI
This static class broadcasts virtual joystick events and handles sensitivity scaling.
Properties
public static float JoystickSensitivity { get; set; } = 1.0f;
Scales the joystick output. Default is 1.0
. Increase to amplify movement values.
Events
public static event Action<JoystickIdentifier, Vector2> OnJoystickValueChanged; public static event Action<JoystickIdentifier, Vector2> OnJoystickPressed; public static event Action<JoystickIdentifier, Vector2> OnJoystickReleased;
- OnJoystickValueChanged: Fired when the joystick is moved.
Vector2
is normalized (range -1 to 1). - OnJoystickPressed: Fired when the joystick is touched for the first time.
- OnJoystickReleased: Fired when the joystick is released.
Methods
public static void UpdateJoystick(JoystickIdentifier id, Vector2 rawValue)
Scales and sends joystick movement to OnJoystickValueChanged
.
public static void JoystickPressed(JoystickIdentifier id, Vector2 position)
Fires OnJoystickPressed
at the given screen position.
public static void JoystickReleased(JoystickIdentifier id, Vector2 position)
Fires OnJoystickReleased
when the finger is lifted.
Usage Example
void OnEnable() { JoystickOutputAPI.OnJoystickValueChanged += HandleJoystickMove; JoystickOutputAPI.OnJoystickPressed += HandleJoystickPressed; JoystickOutputAPI.OnJoystickReleased += HandleJoystickReleased; } void OnDisable() { JoystickOutputAPI.OnJoystickValueChanged -= HandleJoystickMove; JoystickOutputAPI.OnJoystickPressed -= HandleJoystickPressed; JoystickOutputAPI.OnJoystickReleased -= HandleJoystickReleased; }
Best Practices
- Always use unique
JoystickIdentifier
values per joystick instance. - Subscribe to events in
OnEnable()
and clean up inOnDisable()
. - Use
JoystickSensitivity
for dynamic scaling. - Normalize values as needed for movement logic or UI input.