How to vibrate your android device during gameplay in Unity

Vibration is a great way to give feedback to the player on being attacked. In this tutorial, we will see how you can vibrate an android device in Unity.

Unity has a simple solution for this. Just add the code below to make your phone vibrate. This will work in both Android and IOS.


This works very well but if you want to control the duration of vibration, there is a script written by aVolpe in Github. It’s a custom vibration C# class that you can call to change the vibration duration.

Though the script works on both IOS and Android, the duration is only available for android.

To vibrate your device just call the function of the class.

void Start()

Vibrate permission is required in some cases. You can either make your own manifest to allow vibrations, or Unity creates it automatically with the “Handheld.Vibrate()” line. If your phone doesn’t vibrate with the above code. Then this might be the cause.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.