> For the complete documentation index, see [llms.txt](https://solo-player.gitbook.io/most-in-one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://solo-player.gitbook.io/most-in-one/most-systems/most-haptic-feedback.md).

# MOST Haptic Feedback

Quick and simple MOST, but it's essential for all mobile games...

<figure><img src="/files/1meQzNNKzweuxfONPcr8" alt="" width="375"><figcaption><p>Haptic Feedback Demo scene</p></figcaption></figure>

## <mark style="color:yellow;">Key Features</mark> 🔥

* Works on iOS (10+ / iPhone 7 or above) and Android (5.0+)
* Automatically adapts to device capabilities
* No dependencies required
* iOS: All HapticFeedback from IOS UIKit + Custom Haptic Pattern generator
* Android: Custom vibration patterns generator with amplitude control
* Regular Vibrate: fallbacks for unsupported devices
* GetHapticStatus() to check device support
* Editor-safe (no errors in Play Mode)
* One-line setup: \`HapticManager.Generate(HapticTypes.Success);\`
* No manual Xcode/AndroidManifest edits required
* Includes ready-to-use prefabs and example scripts
* Toggle haptics globally with \`HapticManager.HapticsEnabled\`
* Auto-fallback for unsupported devices

## <mark style="color:red;">Enable and Disable</mark> Haptic feedback globally

```csharp
// Enable or disable haptic feedback globally // Saved in-game data
Most_HapticFeedback.HapticsEnabled return or set bool
```

## <mark style="color:red;">Generate</mark> Basic haptic feedback

<pre class="language-csharp"><code class="lang-csharp">// generate a haptic feedback from the built-in(API) haptics
Most_HapticFeedback.Generate(Most_HapticFeedback.HapticTypes);

// generate a haptic feedback from the built-in(API) haptics and set a cooldown after
// Haptic With Cooldown is very useful for continuous haptic spamming
// for example... Sliders, Scrolling, continuous damage...
Most_HapticFeedback.GenerateWithCooldown(Most_HapticFeedback.HapticTypes, cooldown);

<strong>// ___________ All Baisc Haptics from iOS UIToolKit ___________ //
</strong><strong>
</strong>// These names from iOS UIToolKit // call it default haptics
Selection    // case 0 // IOS 10+
Success      // case 1 // IOS 10+
Warning      // case 2 // IOS 10+
Failure      // case 3 // IOS 10+
LightImpact  // case 4 // IOS 10+
MediumImpact // case 5 // IOS 10+
HeavyImpact  // case 6 // IOS 10+
RigidImpact  // case 7 // IOS 13+ &#x3C;&#x3C;
SoftImpact   // case 8 // IOS 13+ &#x3C;&#x3C;

// I used these names to make a default haptics for Android as well
// you will find IOSDefaultHapticsToAndroidPatterns() function inside MOST_HapticFeedback
// and edit these values if you want
</code></pre>

## <mark style="color:red;">Examples:</mark> Basic haptic feedback

```csharp
// To call haptic type
Most_HapticFeedback.HapticTypes.Type;

// example // define a selection haptic
Most_HapticFeedback.HapticTypes.Selection;

// example // haptic feedback as a public property
public Most_HapticFeedback.HapticTypes BasicHaptic;

// example // for activating a haptic feedback
Most_HapticFeedback.Generate(Most_HapticFeedback.HapticTypes.Selection);

// example // for activating a haptic feedback using public property
Most_HapticFeedback.Generate(BasicHaptic); 

// example // for activating a haptic feedback with cooldown using public property
Most_HapticFeedback.GenerateWithCooldown(BasicHaptic, 0.1f);
```

## <mark style="color:red;">Custom Haptic Pattern</mark>

```csharp
// define a custom haptic as a public property
public Most_HapticFeedback.CustomHapticPattern CustomHapticPattern;
```

<figure><img src="/files/K5DImRYAtDq7aSOWKQmw" alt=""><figcaption><p>Custom haptic pattern as public property</p></figcaption></figure>

<mark style="color:blue;">**iOS Haptic Pattern**</mark>

* <mark style="color:yellow;">**Delay:**</mark> the delay before starting this pulse  <mark style="color:red;">in milliseconds</mark>
* <mark style="color:yellow;">**Pulse Type:**</mark> Haptic type of this pulse

<mark style="color:blue;">**Android Haptic Pattern**</mark>

* <mark style="color:yellow;">**Delay:**</mark> the delay before starting this pulse  <mark style="color:red;">in milliseconds</mark>
* <mark style="color:yellow;">**Pulse Time:**</mark> Pulse time  <mark style="color:red;">in milliseconds</mark>
* <mark style="color:yellow;">**Pulse Strength:**</mark> vibration strength of the pulse  <mark style="color:red;">integer (0-255)</mark>

<mark style="color:yellow;">**After creating the haptic pattern for Android and iOS you can now test it on a real device.**</mark>

```csharp
// Call a custom haptic pattern patterns
Most_HapticFeedback.Generate(CustomHapticPattern);
```

## <mark style="color:red;">Custom Haptic Curve</mark>

```
// define an iOS-Android haptic curve as a public property
public Most_HapticFeedback.HapticCurve HapticCurve;

// define an iOS haptic curve as a public property
public Most_HapticFeedback.iOSHapticCurve iOSHapticCurve;

// define an Android haptic curve as a public property
public Most_HapticFeedback.AndroidHapticCurve AndroidHapticCurve;
```

<figure><img src="/files/vb4uX19rjWIq2meQiaVn" alt=""><figcaption></figcaption></figure>

<mark style="color:blue;">**iOS Haptic Curve**</mark>

* <mark style="color:yellow;">**Delay:**</mark> the delay before starting the haptic <mark style="color:red;">in milliseconds</mark>
* <mark style="color:yellow;">**DurationMs:**</mark> the total Android curve duration <mark style="color:red;">in milliseconds</mark>
* <mark style="color:yellow;">**Sharpness:**</mark> Core Haptic sharpness <mark style="color:red;">(0-1)</mark>
* <mark style="color:yellow;">**Samples:**</mark> Number of core haptics control points sampled from the intensity <mark style="color:red;">(2-64 (editable))</mark>&#x20;
* <mark style="color:yellow;">**Fallback:**</mark>**&#x20;used when amplitude curves are unavailable**

<mark style="color:blue;">**Android Haptic Curve**</mark>

* <mark style="color:yellow;">**Delay:**</mark> the delay before starting the haptic <mark style="color:red;">in milliseconds</mark>
* <mark style="color:yellow;">**DurationMs:**</mark> the total Android curve duration <mark style="color:red;">in milliseconds</mark>
* <mark style="color:yellow;">**Samples:**</mark> Number of waveform segments sampled from the intensity
* <mark style="color:yellow;">**Max Amplitude:**</mark> Maximum Android amplitude  <mark style="color:red;">integer (0-255)</mark>
* <mark style="color:yellow;">**Fallback:**</mark>**&#x20;used when amplitude curves are unavailable**
