Skip to content
Merged
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
20 changes: 12 additions & 8 deletions UnityMcpBridge/Editor/Tools/ReadConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,18 @@ bool includeStacktrace

// --- Formatting ---
string stackTrace = includeStacktrace ? ExtractStackTrace(message) : null;
// Get first line if stack is present and requested, otherwise use full message
string messageOnly =
(includeStacktrace && !string.IsNullOrEmpty(stackTrace))
? message.Split(
new[] { '\n', '\r' },
StringSplitOptions.RemoveEmptyEntries
)[0]
: message;
// Always get first line for the message, use full message only if no stack trace exists
string[] messageLines = message.Split(
new[] { '\n', '\r' },
StringSplitOptions.RemoveEmptyEntries
);
string messageOnly = messageLines.Length > 0 ? messageLines[0] : message;

// If not including stacktrace, ensure we only show the first line
if (!includeStacktrace)
{
stackTrace = null;
}

object formattedEntry = null;
switch (format)
Expand Down