Skip to content

Test Runner exceptions when the GUI does not. #367

@bazzboyy1

Description

@bazzboyy1

There seems to be anm issue with the UnityMCP - run_tests (MCP)(mode: "play") command.

Basically if I try have claude code run the test runner, the test runner throws exceptions. When I run the tests manually via the GUI, it works fine.

It's pretty important that this works for iteration purposes.

I sincerely apologise for this horrendous console dump:

UnityMCP - read_console (MCP)(action: "get", count: 50, format: "detailed")
⎿ {
"success": true,
"message": "Retrieved 9 log entries.",
"data": [
{
"type": "Log",
"message": "<color=#2EA3FF>MCP-FOR-UNITY: MCPForUnityBridge started on port 6400.
(OS=WindowsEditor, server=6.3.0)",
"file": "./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/Helpers/McpLog.cs",
"line": 20,
"stackTrace": "UnityEngine.Debug:Log (object)\nMCPForUnity.Editor.Helpers.McpLog:Info (string,bool) (at
./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/Helpers/McpLog.cs:20)\nMCPForUnity.Editor.MC
PForUnityBridge:Start () (at ./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/MCPForUnityBrid
ge.cs:395)\nMCPForUnity.Editor.MCPForUnityBridge:EnsureStartedOnEditorIdle () (at
./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/MCPForUnityBridge.cs:267)\nUnityEditor.Edito
rApplication:Internal_CallUpdateFunctions ()"
},
{
"type": "Log",
"message": "<color=#2EA3FF>MCP-FOR-UNITY: Auto-discovered 10 tools and 3 resources (13
total handlers)",
"file": "./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/Helpers/McpLog.cs",
"line": 20,
"stackTrace": "UnityEngine.Debug:Log (object)\nMCPForUnity.Editor.Helpers.McpLog:Info (string,bool) (at
./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/Helpers/McpLog.cs:20)\nMCPForUnity.Editor.To
ols.CommandRegistry:AutoDiscoverCommands () (at ./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Edi
tor/Tools/CommandRegistry.cs:101)\nMCPForUnity.Editor.Tools.CommandRegistry:Initialize () (at
./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/Tools/CommandRegistry.cs:50)\nMCPForUnity.Ed
itor.MCPForUnityBridge:Start () (at ./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/MCPForUn
ityBridge.cs:399)\nMCPForUnity.Editor.MCPForUnityBridge:EnsureStartedOnEditorIdle () (at
./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/MCPForUnityBridge.cs:267)\nUnityEditor.Edito
rApplication:Internal_CallUpdateFunctions ()"
},
{
"type": "Log",
"message": "<color=#2EA3FF>MCP-FOR-UNITY: No PythonToolsAsset found. Create one via Assets
> Create > MCP For Unity > Python Tools",
"file": "./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/Helpers/McpLog.cs",
"line": 20,
"stackTrace": "UnityEngine.Debug:Log (object)\nMCPForUnity.Editor.Helpers.McpLog:Info (string,bool) (at
./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/Helpers/McpLog.cs:20)\nMCPForUnity.Editor.Se
rvices.ToolSyncService:SyncProjectTools (string) (at ./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038b
e/Editor/Services/ToolSyncService.cs:32)\nMCPForUnity.Editor.Helpers.PythonToolSyncProcessor:SyncAllTools ()
(at ./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/Helpers/PythonToolSyncProcessor.cs:96)\n
MCPForUnity.Editor.Helpers.PythonToolSyncProcessor/<>c:<.cctor>b__2_0 () (at
./Library/PackageCache/com.coplaydev.unity-mcp@2ab49ec038be/Editor/Helpers/PythonToolSyncProcessor.cs:29)\nUnit
yEditor.EditorApplication:Internal_CallDelayFunctions ()"
},
{
"type": "Exception",
"message": "InvalidOperationException: This cannot be used during play mode.",
"file": "./Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/TestRun/Task
s/Scene/SaveModifiedSceneTask.cs",
"line": 13,
"stackTrace": "UnityEditor.SceneManagement.EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo
(System.String message) (at <08b6666d108d4c9796450fb85df4d5b2>:0)\nUnityEditor.SceneManagement.EditorSceneManag
er.SaveCurrentModifiedScenesIfUserWantsTo () (at <08b6666d108d4c9796450fb85df4d5b2>:0)\nUnityEditor.TestTools.T
estRunner.TestRun.Tasks.Scene.SaveModifiedSceneTask+d__1.MoveNext () (at
./Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/TestRun/Tasks/Scene/SaveMod
ifiedSceneTask.cs:13)\nUnityEditor.TestTools.TestRunner.TestRun.TestJobRunner.ExecuteStep () (at
./Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/TestRun/TestJobRunner.cs:17
3)\nUnityEditor.EditorApplication:Internal_CallUpdateFunctions()"
},
{
"type": "Log",
"message": "An unexpected error happened while running tests.",
"file": "./Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/Api/Callback
sDelegator.cs",
"line": 67,
"stackTrace": "UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()"
},
{
"type": "Log",
"message": "Too many instant steps in test execution mode: Error. Current task ExitPlayModeTask.",
"file":
"./Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/TestRun/TestJobRunner.cs",
"line": 119,
"stackTrace": "UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()"
},
{
"type": "Exception",
"message": "Exception: Playmode tests were aborted because the player was stopped.",
"file": "./Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/TestRun/Task
s/PlayModeRunTask.cs",
"line": 59,
"stackTrace": "UnityEditor.TestTools.TestRunner.TestRun.Tasks.PlayModeRunTask+d__1.MoveNext ()
(at ./Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/TestRun/Tasks/PlayModeR
unTask.cs:59)\nUnityEditor.TestTools.TestRunner.TestRun.TestJobRunner.ExecuteStep () (at
./Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/TestRun/TestJobRunner.cs:17
3)\nUnityEditor.EditorApplication:Internal_CallUpdateFunctions()"
},
{
"type": "Log",
"message": "An unexpected error happened while running tests.",
"file": "./Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/Api/Callback
sDelegator.cs",
"line": 67,
"stackTrace": "UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()"
},
{
"type": "Warning",
"message": "Executing IPostBuildCleanup for: Unity.PerformanceTesting.Editor.TestRunBuilder.",
"file": "./Library/PackageCache/com.unity.test-framework@5ac417e07314/UnityEditor.TestRunner/TestRun/Task
s/BuildActionTaskBase.cs",
"line": 51,
"stackTrace": "UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()"
}
]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions