🚀 Quickstart: Your First Implementation

Step 0: Assemblies

Haptics Lite is encapsulated within its own Assembly Definition (Canley.Utility.Haptics) to keep your project structure clean. If your scripts use .asmdef files, you must add a reference to Canley.Utility.Haptics to “unlock” the namespace.

1. Setup & Namespace

Unlike many Unity plugins, Haptics Lite requires zero scene configuration. There is no prefab to drag in and no manager to initialize. Simply add the namespace to the top of any script where you want tactile feedback:

using Canley.Utility.Haptics;

2. Trigger Haptics

Access the engine globally via the CanleyHaptics static class. Use the Trigger method and select a qualitative style that fits your gameplay event:

// Example: Trigger a sharp click for a UI button
public void OnButtonClick()
{
    CanleyHaptics.Trigger(CanleyHaptics.HapticStyle.MediumBump);
}

3. Toggling Haptics (Options Menu)

Respect user accessibility preferences by linking your “Mute Haptics” UI toggle directly to the global master switch. When set to false, all haptic calls are bypassed at the C# level to save performance.

// Link this directly to your UI Toggle's OnValueChanged event
public void SetHapticsEnabled(bool status)
{
    CanleyHaptics.Enabled = status;
}

4. Editor Testing

You don’t need a mobile device connected to verify your implementation. When running in the Unity Editor, the engine simulates haptic events by printing color-coded logs to the Console:

[CanleyHaptics] Simulated: TriplePulse


TIP

iOS Support Note: For the native Taptic engine to function on iPhones, ensure CanleyHapticBridge.mm remains in Assets/Canley/Common/Plugins/iOS/. This file is the essential bridge between Unity and the Objective-C framework.