Root Cause Identified
After testing, we confirmed that gameobject-find does work for runtime objects — but only when they are in the active scene's root hierarchy.
The Problem
Some games use DontDestroyOnLoad to keep UI objects alive across scene transitions. These objects are not in any regular scene's root hierarchy.
Verification:
Scene TFW_Logo: rootCount=0, GetRootGameObjects()=0
BtnClose.scene.name = "DontDestroyOnLoad"
GameObject.Find("BtnClose") → found (Unity searches all loaded objects)
In GameObjectUtils.Editor.cs, FindRootGameObjects() only searches:
var rootGos = EditorSceneManager.GetActiveScene().GetRootGameObjects();
This returns 0 objects when the UI is in DontDestroyOnLoad.
Suggested Fix By AI
Add DontDestroyOnLoad scene's root objects to the search scope, or as a simpler fallback in FindByName:
// After scene root search fails
var fallback = GameObject.Find(name);
if (fallback != null) return fallback;
Test Environment: Unity MCP Plugin v0.81.0, Unity Editor in Play Mode, game uses DontDestroyOnLoad for all UI canvases.
https://github.com/IvanMurzak/Unity-MCP/issues/823
Root Cause Identified
After testing, we confirmed that gameobject-find does work for runtime objects — but only when they are in the active scene's root hierarchy.
The Problem
Some games use DontDestroyOnLoad to keep UI objects alive across scene transitions. These objects are not in any regular scene's root hierarchy.
Verification:
Scene TFW_Logo: rootCount=0, GetRootGameObjects()=0
BtnClose.scene.name = "DontDestroyOnLoad"
GameObject.Find("BtnClose") → found (Unity searches all loaded objects)
In GameObjectUtils.Editor.cs, FindRootGameObjects() only searches:
var rootGos = EditorSceneManager.GetActiveScene().GetRootGameObjects();
This returns 0 objects when the UI is in DontDestroyOnLoad.
Suggested Fix By AI
Add DontDestroyOnLoad scene's root objects to the search scope, or as a simpler fallback in FindByName:
// After scene root search fails
var fallback = GameObject.Find(name);
if (fallback != null) return fallback;
Test Environment: Unity MCP Plugin v0.81.0, Unity Editor in Play Mode, game uses DontDestroyOnLoad for all UI canvases.
https://github.com/IvanMurzak/Unity-MCP/issues/823