Skip to content

No RPC method to switch the active build platform (PC <-> Android, etc.) #167

Description

@Daliys

Summary

An external agent (Codex) reported that Nexus Unity "failed and could not switch the platform from PC to Android." This is a genuine tool-coverage gap, not a bug in an existing feature.

Root cause

  • Nexus Unity only reports the active build target, it never sets it. get_editor_state exposes platform as a read-only field.
  • There is no RPC method anywhere in the codebase that calls EditorUserBuildSettings.SwitchActiveBuildTarget / BuildPipeline.SwitchActiveBuildTarget (confirmed via full-repo grep, zero matches).
  • The only generic escape hatch is execute_menu_item, a thin wrapper over EditorApplication.ExecuteMenuItem.
    • Editor/MCPServerMethods.Editor.cs:192-197
    • ExecuteMenuItem only works for items registered as top-level [MenuItem] commands. It can open the Build Settings window (File/Build Settings...), but it cannot click the "Switch Platform" button inside that window, because that button is a control inside a custom EditorWindow, not an addressable menu command.

Impact

Any agent asked to change target platform will either silently no-op (menu item executes but does nothing useful) or report failure, because there is currently no supported path to do this via the bridge at all.

Notes for the fix (not doing it now)

  • Add a dedicated RPC (e.g. set_build_target / switch_platform) that calls EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup, BuildTarget) directly.
  • Platform switches are slow/blocking (asset reimport) and can't complete synchronously within a single request/response cycle — the RPC will need an async/polling pattern (e.g. kick off the switch, then let the caller poll is_compiling/a dedicated status field) rather than blocking the HTTP handler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: mediumImportant defect or workflow gap with workaroundsurface: unity-editorUnity Editor package, windows, menus, or C# server surface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions