Skip to content

Instantly share code, notes, and snippets.

View Soundpiercer's full-sized avatar
🙃
I may be slow to respond.

Sound piercer Official Soundpiercer

🙃
I may be slow to respond.
View GitHub Profile
@Soundpiercer
Soundpiercer / Vibration.cs
Created August 15, 2019 09:09 — forked from aVolpe/Vibration.cs
Vibration for Unity3d with Android native Call, with fallback to Handlheld.Vibrate()
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");
@Soundpiercer
Soundpiercer / Vibration.cs
Created August 15, 2019 09:09 — forked from aVolpe/Vibration.cs
Vibration for Unity3d with Android native Call, with fallback to Handlheld.Vibrate()
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");