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.

ClassMethod (Syntax)Description
CanleyHapticsTrigger(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.

ClassMember (Syntax)Description
CanleyHapticsEnabledGlobal master toggle for all haptic feedback. Useful for ‘Disable Haptics’ settings.
CanleyHapticsHapticStyleEnum 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 UIImpactFeedbackGenerator and UINotificationFeedbackGenerator.
  • 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.Enabled property to provide a project-wide haptic mute functionality instantly.


3 items under this folder.