| 1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- using System.Runtime.InteropServices;
- internal static class NativeAppInfo
- {
- #if UNITY_IOS && !UNITY_EDITOR
- [DllImport("__Internal")]
- private static extern IntPtr AppRuntimes_GetTestUserID();
- [DllImport("__Internal")]
- private static extern int AppRuntimes_GetEnableUnityLog();
- [DllImport("__Internal")]
- private static extern void AppRuntimes_FreeString(IntPtr value);
- #endif
- internal static bool GetEnableUnityLog()
- {
- #if UNITY_IOS && !UNITY_EDITOR
- return AppRuntimes_GetEnableUnityLog() != 0;
- #else
- return false;
- #endif
- }
- internal static string GetTestUrl()
- {
- #if UNITY_IOS && !UNITY_EDITOR
- var value = AppRuntimes_GetTestUserID();
- if (value == IntPtr.Zero) return string.Empty;
- try { return Marshal.PtrToStringAnsi(value) ?? string.Empty; }
- finally { AppRuntimes_FreeString(value); }
- #else
- return string.Empty;
- #endif
- }
- }
|