Detailed Member Reference
Namespace: Canley.Utility.Haptics
Class: CanleyHaptics
Enabled
public static bool Enabled = true;-
Description: A global master toggle that controls the output of all haptic feedback across the entire project.
-
Workflow:
- State Persistence: Because this is a
staticboolean, its value persists across scene loads for the duration of the application session. - Gatekeeping: The
Trigger()method evaluates this property as its very first instruction. Iffalse, the method returns immediately, bypassing all platform-specific native logic.
- State Persistence: Because this is a
-
Property Type:
bool(Default:true) -
Access: Read/Write
-
Example:
using Canley.Utility.Haptics;
using UnityEngine;
using UnityEngine.UI;
public class SettingsMenu : MonoBehaviour
{
public void OnToggleHaptics(bool isOn)
{
// One-line update to the global haptics state
CanleyHaptics.Enabled = isOn;
if (isOn)
{
// Optional: provide a "Softest" bump as confirmation when enabled
CanleyHaptics.Trigger(CanleyHaptics.HapticStyle.SoftestBump);
}
}
}TIP
This property is the ideal hook for your game’s “Options” or “Accessibility” menu. Linking it directly to a UI Toggle ensures your game respects player preferences without requiring you to manually check the setting before every haptic call in your gameplay scripts.