# Unity

Our UPM package allows playback of custom haptics on both Android and iOS in a cross-platform manner.

Find it on openupm.com and on GitHub for the full API reference and samples.

# Usage

After exporting for iOS, add the exported files to your Unity project's Assets/StreamingAssets directory (create it if it doesn't exist yet). Similarly, after exporting for Android, move the exported files to your Unity project's Assets/StreamingAssets directory as well.

In Unity, drag the Custom.cs MonoBehavior onto your GameObject. Select a HAC for Android and an AHAP file to be played.

Now, you can easily trigger the haptic playback:

public class MyButton : MonoBehaviour
{
    public HapticlabsCustom hapticCustom;

    public void OnButtonPressed()
    {
        hapticCustom.TriggerHaptics();
    }
}

A full working example for the usage can be found in our repo.