18 lines
498 B
C#
18 lines
498 B
C#
namespace Cryville.Common.Unity {
|
|
public static class UrlOpener {
|
|
public static void Open(string url) {
|
|
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
|
|
System.Diagnostics.Process.Start(url);
|
|
#elif UNITY_ANDROID
|
|
UnityEngine.AndroidJNI.AttachCurrentThread();
|
|
using (var clazz = new UnityEngine.AndroidJavaClass("world.cryville.common.unity.UrlOpener")) {
|
|
clazz.CallStatic("open", url);
|
|
}
|
|
UnityEngine.AndroidJNI.DetachCurrentThread();
|
|
#else
|
|
#error Unknown platform.
|
|
#endif
|
|
}
|
|
}
|
|
}
|