diff --git a/Assets/AppCenter/Editor/AppCenterPostBuild.cs b/Assets/AppCenter/Editor/AppCenterPostBuild.cs index a164df08..4db87c1d 100644 --- a/Assets/AppCenter/Editor/AppCenterPostBuild.cs +++ b/Assets/AppCenter/Editor/AppCenterPostBuild.cs @@ -105,6 +105,8 @@ public static void FixIl2CppLogging(string pathToBuiltProject) * combine some files on the compilation so the changes in one file can affect another. */ codeLines.Insert(lastIncludeLineIndex + 2, "#undef GetCurrentDirectory"); + codeLines.Insert(lastIncludeLineIndex + 3, "#undef ZeroMemory"); + codeLines.Insert(lastIncludeLineIndex + 4, "#undef MemoryBarrier"); // Add logging method. var logMethodLineIndex = SearchForLine(codeLines, "void Debugger::Log"); @@ -112,8 +114,14 @@ public static void FixIl2CppLogging(string pathToBuiltProject) { throw new Exception("Unexpected content of Debugger.cpp"); } + var insertingPosition = GetFirstLineInMethodBody(codeLines, logMethodLineIndex); + +#if UNITY_2021_1_OR_NEWER + codeLines.Insert(insertingPosition, "OutputDebugStringW((*message)->chars);"); +#else codeLines.Insert(insertingPosition, "OutputDebugStringW(message->chars);"); +#endif // Enable logging. var isLoggingMethodLineIndex = SearchForLine(codeLines, "bool Debugger::IsLogging"); @@ -284,9 +292,9 @@ internal static string GetAttributeValue(XElement element, string attributeName) return attribute == null ? null : attribute.Value; } - #endregion +#endregion - #region iOS Methods +#region iOS Methods private static void OnPostprocessProject(PBXProjectWrapper project) { // Need to add SQLite and zlib dependencies. @@ -336,5 +344,5 @@ private static void OnPostprocessInfo(PlistDocumentWrapper info, AppCenterSettin } } - #endregion +#endregion }