26 T5_Bool attentionRequested =
false;
29 var result =
NativePlugin.IsTiltFiveUIRequestingAttention(ref attentionRequested);
43 return attentionRequested;
62 internal static bool SetApplicationInfo()
64 string applicationName = Application.productName;
67 applicationName = $
"Unity Editor: {applicationName}";
69 string applicationId = Application.identifier;
70 string productVersion = Application.version;
71 string engineVersion = Application.unityVersion;
72 TextAsset pluginVersionAsset = (TextAsset)Resources.Load(
"pluginversion");
73 string applicationVersionInfo = $
"App: {productVersion}, Engine: {engineVersion}, T5 SDK: {pluginVersionAsset.text}";
75 int result = NativePlugin.T5_RESULT_UNKNOWN_ERROR;
79 using (T5_StringUTF8 appName = applicationName)
80 using (T5_StringUTF8 appId = applicationId)
81 using (T5_StringUTF8 appVersion = applicationVersionInfo)
83 result = NativePlugin.SetApplicationInfo(appName, appId, appVersion);
86 catch (System.DllNotFoundException e)
88 Log.
Info(
"Could not connect to Tilt Five plugin to register project info: {0}", e);
92 Log.
Error(
"Failed to register project info with the Tilt Five service.");
95 return result == NativePlugin.T5_RESULT_SUCCESS;
98 internal static bool SetPlatformContext()
101 if (Application.platform == RuntimePlatform.Android)
104 AndroidJNI.AttachCurrentThread();
106 IntPtr unityPlayerClazz = AndroidJNI.FindClass(
"com/unity3d/player/UnityPlayer");
107 if (unityPlayerClazz == IntPtr.Zero)
109 Log.
Error(
"Failed to obtain UnityPlayer class via JNI");
113 IntPtr currentActivityFieldId = AndroidJNI.GetStaticFieldID(unityPlayerClazz,
"currentActivity",
"Landroid/app/Activity;");
114 if (currentActivityFieldId == IntPtr.Zero)
116 Log.
Error(
"Failed to obtain UnityPlayer/currentActivity field via JNI");
120 IntPtr currentActivity = AndroidJNI.GetStaticObjectField(unityPlayerClazz, currentActivityFieldId);
121 if (currentActivity == IntPtr.Zero)
123 Log.
Error(
"Failed to obtain UnityPlayer/currentActivity instance via JNI");
127 IntPtr t5ActivityClazz = AndroidJNI.FindClass(
"com/tiltfive/client/TiltFiveActivity");
128 if (t5ActivityClazz == IntPtr.Zero)
130 Log.
Error(
"Failed to obtain TiltFive activity class via JNI");
134 IntPtr getPlatformContextMethodId = AndroidJNI.GetMethodID(t5ActivityClazz,
"getT5PlatformContext",
"()J");
135 if (getPlatformContextMethodId == IntPtr.Zero)
137 Log.
Error(
"Failed to obtain TiltFive getT5PlatformContext() method via JNI");
141 var context = AndroidJNI.CallLongMethod(currentActivity, getPlatformContextMethodId,
new jvalue[] { });
144 Log.
Error(
"Failed to obtain TiltFive platform context via JNI");
151 int result = NativePlugin.SetPlatformContext(
new IntPtr(context));
152 if (result != NativePlugin.T5_RESULT_SUCCESS)
154 Log.
Error(
"Tilt Five platform context set returned error: {0}", result);
157 catch (System.DllNotFoundException e)
159 Log.
Info(
"Tilt Five plugin unavailable for set platform context: {0}", e);
164 Log.
Error(
"Failed to set Tilt Five platform context: {0}", e);
static void Info(string m, params object[] list)
INFO logging function call.
static void Error(string m, params object[] list)
ERROR logging function call.
static bool IsTiltFiveUIRequestingAttention()
ServiceCompatibility
Whether the running service is compatible.