Repository navigation
Description
I'm trying to work with a modal window prefab, but it seems the MCP doesn't have sufficient tools for working with opened prefabs (not in scene view).
Specifically, I double-click a prefab asset in the project file browser, which opens the prefab in a special isolated view -- that's what I want to work with using the MCP.
My ideal workflow would be:
- Inside the prefab, I create the UI I want myself.
- The AI can access the properties of objects (such as text content) to intelligently rename objects that have a generic default name.
- The AI can hook up these objects into the root parent object modal script serialized fields accordingly.
I tried a basic test of trying to get the AI to access the actively open prefab, rename a generically named text object with the text value "10" to a more descriptive "countdown text" name.
It couldn't access the opened prefab, so I gave the path manually, but it still seems to not be able to access the hierarchy or enough information to do anything useful.
I had the AI generate an issue request, if you find it useful:
Issue Description
The current Unity MCP tools lack functionality to work with prefabs that are actively being edited in the prefab editor. This limitation prevents basic prefab inspection and modification operations that would be valuable for AI-assisted workflows.
Requested Features
-
Access to actively selected/open prefab
- Add ability to detect and reference the prefab currently being edited in the prefab editor
- Return prefab path, type, and basic metadata
-
Prefab hierarchy inspection
- List complete hierarchy of GameObjects within the prefab
- Include component types, names, and relevant properties for each GameObject
- Support filtering by component type or property value
-
Text content searching
- Add capability to find UI elements with specific text content
- Support exact matches and pattern-based searches
- Return hierarchy path to matching elements
-
GameObject renaming in prefab context
- Allow renaming of GameObjects within a prefab hierarchy
- Support renaming by direct GameObject reference
Use Case Example
When editing a UI prefab, an assistant should be able to:
- Detect the prefab is open for editing
- List its full hierarchy
- Find a TextMeshProUGUI component displaying "10"
- Rename its GameObject to a more descriptive name like "CountdownText"
Activity
cloudosed commentedon Apr 15, 2025
It's there any C# function inside unity engine that can achieve your needs?
msanatan commentedon Aug 11, 2025
Awesome use case @KamilDev
msanatan commentedon Sep 26, 2025
We added some more support for prefabs in v4.0.0, but changes in #287 should help
msanatan commentedon Jan 8, 2026
Modifying prefabs has been improved a lot since you post this issue, but there's probably one last change to make this workflow fully complete. I'm thinking a new resource to list the prefab hierarchy. Once there's visibility, this entire flow will work
cyanxwh commentedon Jan 12, 2026
Hi there,
I encountered an issue where UnityMCP fails to modify existing standalone Prefab assets when using the open_stage / save_open_stage workflow. Claude Code attempted to add a component, but the changes were lost after closing the stage.
Actual Behavior:
Workaround found by Claude: Claude eventually had to resort to deleting and recreating the entire prefab from a new GameObject to "apply" the changes, which isn't ideal for existing references.
Full Log:
Click to expand full terminal output
Environment:
UnityMCP version: 9.0.3
Unity version: 6000.0.41f
Claude Code version: 2.1.5
Model: Claude Opus 4.5
It seems like save_open_stage might not be correctly triggering the internal Unity PrefabUtility save or asset database refresh.
whatevertogo commentedon Jan 23, 2026
I already fix that, please wait for the next version
I already fix that, please wait for the next version
fix: prefab stage dirty flag, root rename, test fix, and prefab resou…
dsarno commentedon Jan 26, 2026
Everything in here should now be taken care of, including @msanatan 's suggestion to add read resources to prefab mode.
See #611 and #627 . Thanks all, always feels good to close down an old issue.
msanatan commentedon Jan 26, 2026
@dsarno the legend
dsarno commentedon Jan 26, 2026
Thanks, and big shoutout to @whatevertogo for getting the prefab fixes going!
whatevertogo commentedon Jan 26, 2026