CREATE YOUR WORLD
User Interface
Use haptic vibration
4min
this guide will show you how to implement haptic vibration in zepetoscrip based on the handheld vibrate function provided by unity 📘 handheld https //docs unity3d com/scriptreference/handheld html https //docs unity3d com/scriptreference/handheld html write a script 1\) in the \[project] panel, select the \[+] menu in the upper left corner or select assets > create > zepeto > typescript 2\) 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(() => { handheld vibrate(); }); } } 3\) 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 docid\ foizleqi0jtan3snbtwli ] ❗️ caution please note that handheld vibrate only works in the mobile environment