Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Runtime/Scripts/Internal/FFIClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private static void InitializeSdk()
{
}

Utils.Debug("FFIServer - Initialized");
Utils.Debug($"FFIServer - Initialized, capture logs: {captureLogs}");
initialized = true;
}

Expand Down Expand Up @@ -198,7 +198,7 @@ out UIntPtr dataLen
NativeMethods.FfiDropHandle(handle);

#if LK_VERBOSE
Debug.Log($"FFIClient response of type: {response.MessageCase} with asyncId: {AsyncId(response)}");
Utils.Debug($"FFIClient response of type: {response.MessageCase} with asyncId: {AsyncId(response)}");
#endif

return response;
Expand All @@ -221,6 +221,12 @@ private static unsafe void FFICallback(IntPtr data, UIntPtr size)
return;
#endif

// Prevents app freeze on exit due the registered threads via IL2CPP context
// We already had this issue before and the full explanation is here:
// https://support.unity.com/hc/en-us/requests/3055850
System.Threading.Thread current = System.Threading.Thread.CurrentThread;
if (current.IsBackground == false) current.IsBackground = true;

try
{
if (isDisposed) return;
Expand All @@ -235,7 +241,7 @@ private static unsafe void FFICallback(IntPtr data, UIntPtr size)
{
case FfiEvent.MessageOneofCase.Logs:

Debug.Log($"LK_DEBUG: {response.Logs.Records}");
Utils.Debug($"LK_DEBUG: {response.Logs.Records}");
break;
case FfiEvent.MessageOneofCase.PublishData:
break;
Expand Down
4 changes: 2 additions & 2 deletions Runtime/Scripts/Internal/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ internal static class Utils
[Conditional(LK_DEBUG)]
public static void Debug(object msg)
{
UnityEngine.Debug.unityLogger.Log(LogType.Log, $"{PREFIX}: {msg}");
UnityEngine.Debug.unityLogger.Log(LogType.Log, $"{PREFIX}: {DateTime.UtcNow:HH:mm:ss.fff} : {msg}");
}

public static void Error(object msg)
{
UnityEngine.Debug.unityLogger.Log(LogType.Error, $"{PREFIX}: {msg}");
UnityEngine.Debug.unityLogger.Log(LogType.Error, $"{PREFIX}: {DateTime.UtcNow:HH:mm:ss.fff} : {msg}");
}

public static GraphicsFormat GetSupportedGraphicsFormat(GraphicsDeviceType type)
Expand Down