Skip to content

Instantly share code, notes, and snippets.

Farzad Farazmand farzadfarazmand

View GitHub Profile
@aVolpe
aVolpe / Vibration.cs
Created Oct 16, 2014
Vibration for Unity3d with Android native Call, with fallback to Handlheld.Vibrate()
View Vibration.cs
using UnityEngine;
using System.Collections;
public static class Vibration
{
#if UNITY_ANDROID && !UNITY_EDITOR
public static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
public static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
public static AndroidJavaObject vibrator = currentActivity.Call<AndroidJavaObject>("getSystemService", "vibrator");
You can’t perform that action at this time.