Created
December 11, 2012 12:39
-
-
Save tapuo/4258278 to your computer and use it in GitHub Desktop.
vibration for unity android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UnityEngine | |
class Vibration(MonoBehaviour): | |
private viblator as AndroidJavaObject | |
def Start(): | |
unityPlayer as AndroidJavaClass = AndroidJavaClass("com.unity3d.player.UnityPlayer") | |
currentActivity as AndroidJavaObject = unityPlayer.GetStatic[of AndroidJavaObject]("currentActivity") | |
viblator = currentActivity.Call[of AndroidJavaObject]("getSystemService","vibrator") | |
def _Dummy(): | |
Handheld.Vibrate() | |
def Vibator(time as long): | |
viblator.Call("vibrate", time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this, saved some precious time for me. You deserve a cookie.