Code cleanup.

This commit is contained in:
2023-07-11 00:03:47 +08:00
parent d89423caf5
commit 1dcbc03829
3 changed files with 12 additions and 3 deletions

View File

@@ -4,10 +4,19 @@ namespace Cryville.Common.Unity {
#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);
}
#else
#error Unknown platform.
#endif
}
public static void OpenThreaded(string url) {
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
Open(url);
#elif UNITY_ANDROID
UnityEngine.AndroidJNI.AttachCurrentThread();
Open(url);
UnityEngine.AndroidJNI.DetachCurrentThread();
#else
#error Unknown platform.