Skip to content

Conversation

chennan820
Copy link

@chennan820 chennan820 commented Sep 8, 2025

tested create prefab, modify prefab, delete prefab using Claude CLI client.

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive prefab management tool supporting create, instantiate, open/close, save, modify, find, get info, variant, and unpack. Available in the MCP tool list.
  • Refactor

    • Prefab operations are redirected from game object management to the new prefab tool. Game object management now targets scene objects only, with updated instantiation flow and clearer success messages. get_components can include non-public serialized components.
  • Documentation

    • Updated tool descriptions and error messages to guide users to the new prefab tool for prefab-related tasks.

Copy link
Contributor

coderabbitai bot commented Sep 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a dedicated prefab management tool across editor and server layers. Introduces ManagePrefab.cs with a new “manage_prefab” command and routes/registry entries. Updates manage_gameobject and manage_asset to defer prefab work to the new tool. Extends Python MCP tooling to register and expose manage_prefab; adjusts docs/strings accordingly.

Changes

Cohort / File(s) Summary of Changes
Command routing (Editor)
UnityMcpBridge/Editor/MCPForUnityBridge.cs, UnityMcpBridge/Editor/Tools/CommandRegistry.cs
Add dispatch/registry entries mapping "manage_prefab" to ManagePrefab.HandleCommand; existing routing unchanged.
Prefab tool implementation (Editor)
UnityMcpBridge/Editor/Tools/ManagePrefab.cs, UnityMcpBridge/Editor/Tools/ManagePrefab.cs.meta
New public static class ManagePrefab with HandleCommand and action handlers (create, instantiate, open, close, save, modify, find, get_info, variant, unpack). Adds meta file with GUID.
GameObject/Asset tools adjustments (Editor)
UnityMcpBridge/Editor/Tools/ManageGameObject.cs, UnityMcpBridge/Editor/Tools/ManageAsset.cs
ManageGameObject blocks prefab operations and redirects users to manage_prefab; removes save-as-prefab flow and updates get_components call. ManageAsset prefab branch now errors with instruction to use manage_prefab; removes old prefab comments.
Server tool registration and descriptions
UnityMcpBridge/UnityMcpServer~/src/server.py, UnityMcpBridge/UnityMcpServer~/src/tools/__init__.py
Updates asset_creation_strategy text; adds register_manage_prefab_tools import and invocation to include the new tool in MCP registration.
Python tools: API separation
UnityMcpBridge/UnityMcpServer~/src/tools/manage_gameobject.py, UnityMcpBridge/UnityMcpServer~/src/tools/manage_prefab.py
manage_gameobject: removes prefab-related params/logic; clarifies scope to scene objects. manage_prefab: new tool supporting create/instantiate/open/close/save/modify/find/get_info/variant/unpack; builds params and dispatches to Unity via "manage_prefab".

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Client as MCP Client (Python)
  participant Server as MCP Server (Python)
  participant Unity as Unity Editor
  participant Registry as CommandRegistry
  participant Prefab as ManagePrefab

  User->>Client: Call manage_prefab(action, params)
  Client->>Server: register_manage_prefab_tools (startup)
  Client->>Unity: send_command_with_retry("manage_prefab", params)
  Unity->>Registry: GetHandler("manage_prefab")
  Registry-->>Unity: ManagePrefab.HandleCommand
  Unity->>Prefab: HandleCommand(params)
  Prefab-->>Unity: Response { success, message, data }
  Unity-->>Client: Response
  Client-->>User: Result

  rect rgba(230,250,230,0.6)
    note right of Prefab: Actions handled<br/>- create / instantiate<br/>- open / close / save<br/>- modify / find / get_info<br/>- variant / unpack
  end
Loading
sequenceDiagram
  autonumber
  actor User
  participant Client as manage_gameobject tool
  participant Unity as ManageGameObject.cs
  note over Client, Unity: Prefab operations via manage_gameobject are blocked
  User->>Client: Attempt prefab-related action
  Client-->>User: Error: use manage_prefab
  User->>Client: Use manage_prefab instead
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60–90 minutes

Possibly related PRs

Suggested reviewers

  • Scriptwonder
  • dsarno

Poem

A prefab hop, a sculpted scene,
I nibbled code where assets preen.
New trails to build, instantiate—
Carrots queued, I automate.
From gameobject to prefab’s art,
I twitch, I merge—a hopping start. 🥕✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
		  - name: "Undocumented Breaking Changes"
			  mode: "warning"
			  instructions: |
				  Flag potential breaking changes that are not documented:
				  1. Identify changes to public APIs/exports, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints (including removed/renamed items and changes to types, required params, return values, defaults, or behavior).
				  2. Ignore purely internal/private changes (e.g., code not exported from package entry points or marked internal).
				  3. Verify documentation exists: a "Breaking Change" section in the PR description and updates to CHANGELOG.md.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e83f99 and 044ec3c.

📒 Files selected for processing (10)
  • UnityMcpBridge/Editor/MCPForUnityBridge.cs (1 hunks)
  • UnityMcpBridge/Editor/Tools/CommandRegistry.cs (1 hunks)
  • UnityMcpBridge/Editor/Tools/ManageAsset.cs (1 hunks)
  • UnityMcpBridge/Editor/Tools/ManageGameObject.cs (4 hunks)
  • UnityMcpBridge/Editor/Tools/ManagePrefab.cs (1 hunks)
  • UnityMcpBridge/Editor/Tools/ManagePrefab.cs.meta (1 hunks)
  • UnityMcpBridge/UnityMcpServer~/src/server.py (1 hunks)
  • UnityMcpBridge/UnityMcpServer~/src/tools/__init__.py (2 hunks)
  • UnityMcpBridge/UnityMcpServer~/src/tools/manage_gameobject.py (1 hunks)
  • UnityMcpBridge/UnityMcpServer~/src/tools/manage_prefab.py (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chennan820 chennan820 closed this Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant