🏗️ Architecture Overview

To use the haptics suite effectively, it is essential to understand the relationship between the Static Engine, the Qualitative Enum, and the Native Bridge. This architecture ensures that tactile feedback is high-performance, requires zero scene setup, and scales across mobile hardware.


1. The Engine (The Interface)

The CanleyHaptics class is a Global Static Utility. Unlike a manager that needs to be dragged into a scene, this engine is “always on” and accessible from any script in your project.

  • Interface: It provides the single Trigger() entry point and the global Enabled toggle.
  • Orchestration: It handles platform detection (iOS vs. Android) and filters calls through the master toggle to ensure player “Mute” settings are always respected.

2. The Style Enum (The Qualitative Map)

The HapticStyle enum is the “language” of the suite. It translates human-friendly designer intent into the specific technical constants required by mobile processors.

  • Consistency: It ensures that a MediumBump feels logically similar whether the player is on a flagship iPhone or a mid-range Android device.
  • Selection: By selecting one of the 7 predefined styles, you skip the need to calculate motor frequencies or millisecond durations manually.

3. The Native Bridge (The Data Flow)

When you call Trigger(), the command follows an optimized, hardware-aware path:

  1. Request: Your script calls CanleyHaptics.Trigger(HapticStyle.HeavyBump).
  2. Validation: The Engine checks the Enabled state and the current Platform.
  3. Negotiation: * On iOS: It calls the Objective-C bridge to trigger the Taptic Engine.
    • On Android: It checks the SDK version to choose between Composition Primitives (API 30+), VibrationEffect (API 26+), or Legacy pulses.
  4. Execution: The physical haptic motor fires with sub-millisecond latency.

Why this matters for your implementation

For UI & Gameplay Feedback

Because the architecture is Static, you never have to worry about “finding” a haptics object or checking for null. You can fire a haptic from a UI Button, a collision event, or even a constructor without any scene dependencies.

For Performance & Memory

The engine uses Zero Allocations at runtime. There are no GameObjects to instantiate and no garbage collected during haptic events, making it safe to use in high-intensity action sequences where frame rate is critical.


Summary Table

ObjectTechnical RoleResponsibility
CanleyHapticsStatic EngineGlobal entry point, platform switching, and master toggle.
HapticStyleQualitative EnumMapping designer styles to native hardware constants.
Native BridgePlatform WrapperLow-level communication with iOS (Obj-C) and Android (Java).

Next Steps: Learn how to implement this in your project via the API Reference.