CanleyHaptics
Namespace: Canley.Utility.Haptics
Type: Static Class
Overview
The CanleyHaptics class is the central engine for the suite. It bridges high-level qualitative styles to native hardware implementations on iOS and Android. Because it is a static class, it requires no scene setup and provides a single, high-performance entry point for tactile feedback.
It is designed to be “Zero Configuration,” allowing you to trigger native hardware vibrations with a single line of code from any script in your project.
Method Reference
Detailed documentation for the core engine methods.
| Class | Method (Syntax) | Description |
|---|---|---|
| CanleyHaptics | Trigger(HapticStyle) | The main entry point. Maps the style to the best available native API on the current device. |
Property & Enum Reference
Global settings and qualitative mapping profiles.
| Class | Member (Syntax) | Description |
|---|---|---|
| CanleyHaptics | Enabled | Global master toggle for all haptic feedback. Useful for ‘Disable Haptics’ settings. |
| CanleyHaptics | HapticStyle | Enum defining the 7 qualitative profiles supported by the native bridge. |
Key Features
- Multi-Tier Android Bridge: Automatically chooses between Composition Primitives (API 30+), VibrationEffect (API 26+), or Legacy fallbacks.
- iOS Taptic Integration: Direct interface with Apple’s
UIImpactFeedbackGeneratorandUINotificationFeedbackGenerator. - Editor Simulation: Provides Rich Text console logging in the Unity Editor to verify haptic events without needing a mobile device.
- Zero Allocation: Engineered for performance-critical games, ensuring haptic calls do not trigger Garbage Collection (GC) spikes.
TIP
To save time during UI development, link your “Settings” toggle directly to the
CanleyHaptics.Enabledproperty to provide a project-wide haptic mute functionality instantly.