Studio GuideWorld SDK Guide
Log In

Use haptic vibration

This guide will show you how to implement haptic vibration in ZEPETOScrip based on the Handheld.Vibrate function provided by Unity.



Write a script

  1. In the [Project] panel, select the [+] menu in the upper-left corner or select Assets > Create > ZEPETO > TypeScript.

  1. Name the added script HapticVibration, and write a sample script as shown below.
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { Button } from 'UnityEngine.UI';
import { Handheld } from 'UnityEngine';
export default class HapticVibration extends ZepetoScriptBehaviour {
    public vibrationButton: Button;
    Start() {   
        this.vibrationButton.onClick.AddListener(() => {

  1. Add a GameObject to the Scene and rename it HapticFeedback. Add the HapticVibration ZEPETOScript you created.
    In the Hierachy window, drag & drop the Button UI to the Property shown in the ZEPETOScript Inspector window.

Testing on mobile

  1. Run the example world with the QR mobile test.
  2. When you press the button connected to the script, your device will vibrate.


Please refer to the following guide. [QR mobile test]



Please note that Handheld.Vibrate only works in the mobile environment.