Log Unity stack traces on IL2CPP (#1424)

UnityLogCallback ignored its second parameter, so Unity exceptions and
errors logged only their message. Append the trace for Exception and Error
when Unity gives one. The Mono source already does this for Exception. Log
and Warning stay as they are, since in the game I tested Unity passed a
trace for most of those.

Fixes #660

Co-authored-by: mirfalltnixein <22786734+mirfalltnixein@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-11-05 19:33:09 +01:00
1 parent b782da4ac5
commit 3448ef75c2
1 file changed
+3
@@ -32,6 +32,9 @@ public class IL2CPPUnityLogSource : ILogSource
LogType.Exception => LogLevel.Error,
_ => LogLevel.Message
};
if (type is LogType.Exception or LogType.Error && !string.IsNullOrEmpty(exception))
logLine += $"\nStack trace:\n{exception}";
LogEvent?.Invoke(this, new LogEventArgs(logLine, level, this));
}