Skip to content
Open
Changes from 2 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: 8 additions & 4 deletions Assets/AppCenter/Editor/AppCenterPostBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public static void FixIl2CppLogging(string pathToBuiltProject)
throw new Exception("Unexpected content of Debugger.cpp");
}

#if UNITY_VERSION < UNITY_2021
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to provide fix for new versions or do not call this method at all

// Add '#include <Windows.h>' which provides 'OutputDebugStringW'.
codeLines.Insert(lastIncludeLineIndex + 1, "#include <Windows.h>");

Expand All @@ -105,15 +106,18 @@ 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");

#endif
// Add logging method.
var logMethodLineIndex = SearchForLine(codeLines, "void Debugger::Log");
if (logMethodLineIndex == -1)
{
throw new Exception("Unexpected content of Debugger.cpp");
}

#if UNITY_VERSION < UNITY_2021
var insertingPosition = GetFirstLineInMethodBody(codeLines, logMethodLineIndex);
codeLines.Insert(insertingPosition, "OutputDebugStringW(message->chars);");
#endif

// Enable logging.
var isLoggingMethodLineIndex = SearchForLine(codeLines, "bool Debugger::IsLogging");
Expand Down Expand Up @@ -284,9 +288,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.
Expand Down Expand Up @@ -336,5 +340,5 @@ private static void OnPostprocessInfo(PlistDocumentWrapper info, AppCenterSettin
}
}

#endregion
#endregion
}