要在unity中调用Android系统的震动,需要一个Vibrator类 ,通过AndroidManifest.xml文件设置权限了
如下:
<uses-permission android:name="android.permission.VIBRATE" />
在这里先给贴出英文文档及大概的翻译 :
Class that operates the vibrator on the device.
If your process exits, any vibration you started with will stop.
Vibrator类用来操作设备上的震动,如果你的线程退出了,那么启动的震动也会停止
Pass in an array of ints that are the durations for which to turn on or off the vibrator in milliseconds. The first value indicates the number of milliseconds to wait before turning the vibrator on. The next value indicates the number of milliseconds for which to keep the vibrator on before turning it off.