This is the documentation for Nice Vibrations, the best iOS/Android vibrations asset on Unity's Asset Store.

Introduction

Nice Vibrations is a simple yet powerful solution to add vibrations and haptic feedbacks to your games. Built on top of the native iOS and Android APIs, it offers a universal interface to target gamepads, iOS and Android all at once, as well as ways to get exactly the right vibration on each platform specifically.

It will let you trigger vibrations in multiple ways :

  • basic device vibration, hard to control but efficient
  • base haptic patterns : 9 varied and subtle ways to trigger nice haptics
  • transient haptics : short burst of controlled intensity and sharpness
  • continuous haptics : long controlled haptics with varying intensity over time
  • advanced patterns : the most refined and advanced way to play haptics, with very fine variations over time, that will let your users “feel” sounds

This documentation covers all there is to know about Nice Vibrations, and will let you get started quickly. If you really want more, you can have a look at the API documentation, or just open up the asset’s scripts and look under the hood. All methods are commented, so you’ll have no trouble understanding how it all works.

Does it work everywhere ?

Short answer, yes, Nice Vibrations will let you get the best of each platform’s haptic or rumble API, in a unified way. But of course, you’ll get better quality haptics on better hardware, and some manufacturers put more love into their haptic engines than others. In general, iOS phones perform much better than Android ones, and provide more control, so you get a much satisfying experience. Gamepads also vary greatly in how they let you fine tweak vibrations.

On iOS : Nice Vibrations supports “old” taptic engine iOS vibrations (starting with iOS 10 and iPhone 7) and also supports CoreHaptics vibrations (which is only supported on iPhone 8 and more, running iOS13+). Note that a number of advanced functions (continuous, transients, AHAP support) depend on the support of the Core Haptics API, which was introduced with iOS 13. Note that building for iOS can sometimes get a bit messy if you’re using SDKs like Firebase or Facebook, that mess with the build settings. If that’s the case, it’s usually very easy to solve, make sure you read the iOS build section of this documentation.

On Android : For Android devices running an SDK version lower than 25, you won’t be able to control the magnitude, and overall you’ll have less control over your vibrations. After that it gets better. Just make sure you turn off battery saver mode, and have vibrations enabled in your phone’s settings.

On console : complete support for PS4, XBox and Switch controllers, when connected to their respective consoles. You may have to install additional console specific input packages from Unity in your project.

On PC : PS4 and XBox controllers

On Mac: PS4 controllers only for now

Can I build anywhere?

If you’re targeting Android or PC/Consoles, yes. If you want to build for iOS, you’ll need to build on a Mac to do so before Nice Vibrations 3.5. Building on Windows will work in most situations, but depending on your context, this may be made more complex. Building on Unity Cloud Build, at the moment, will very likely not work, due to Unity changing things in how they handle bridging to native APIs.

Do I need all these dependencies?

Due to the new package orientation of Unity, Nice Vibrations now requires a few packages to be installed to be used at its full potential.

If you want to use rumble vibrations, you’ll need the Input package. Feel free to not install it if you don’t care about rumble. If you’ve already installed it, but don’t want to use it anymore, simply remove it from the Package Manager panel. If you’ve already installed Nice Vibrations at this point, you’ll get errors, that’s normal. Simply go to Edit > Project Settings > Player, then in the “Other Settings” panel, look for the Scripting Define Symbols panel. In it you’ll find a list of symbols, simply remove the MOREMOUNTAINS_NICEVIBRATIONS_RUMBLE entry (leave the rest).

The asset also uses Newtonsoft.Json.dll, a JSon converter to simplify advanced haptic patterns generation. Likewise, if you don’t need that feature, simply remove it. If you’ve already got a version of it in your project (it’s a common library), it’s probably safe to remove the one that ships with Nice Vibrations.