CoplayDev/unity-mcp · error · RuntimeError

Assets folder not found: {assets_dir}

Error message

Assets folder not found: {assets_dir}

What it means

Raised when asset_project / 'Assets' is not a directory. The Asset Store upload must target a valid Unity project, and every Unity project has an Assets/ folder at its root. Its absence means the --asset-project path is not a Unity project (or doesn't exist).

Source

Thrown at tools/prepare_unity_asset_store_release.py:115

        help="Only validate that operations would succeed; do not write/copy/delete.",
    )
    args = parser.parse_args()

    repo_root = Path(args.repo_root).expanduser().resolve()
    asset_project = Path(args.asset_project).expanduser().resolve(
    ) if args.asset_project else (repo_root / "TestProjects" / "AssetStoreUploads")
    remote_url = args.remote_url.strip()
    if not remote_url:
        raise RuntimeError("--remote-url must be a non-empty URL")

    source_mcp = repo_root / "MCPForUnity"
    if not source_mcp.is_dir():
        raise RuntimeError(
            f"Source MCPForUnity folder not found: {source_mcp}")

    assets_dir = asset_project / "Assets"
    if not assets_dir.is_dir():
        raise RuntimeError(f"Assets folder not found: {assets_dir}")

    dest_mcp = assets_dir / "MCPForUnity"

    if args.dry_run:
        print("[dry-run] Validated paths. No changes applied.")
        print("[dry-run] Would stage a temporary copy of MCPForUnity and apply Asset Store edits there.")
        print(
            f"[dry-run] Would replace:\n- {dest_mcp}\n  with\n- {source_mcp}")
        return 0

    # 1) Stage a temporary copy of MCPForUnity and apply Asset Store-specific edits there.
    with tempfile.TemporaryDirectory(prefix="mcpforunity_assetstore_") as tmpdir:
        staged_mcp = Path(tmpdir) / "MCPForUnity"
        shutil.copytree(source_mcp, staged_mcp)

        setup_service = staged_mcp / "Editor" / "Setup" / "SetupWindowService.cs"
        menu_file = staged_mcp / "Editor" / "MenuItems" / "MCPForUnityMenu.cs"
        http_util = staged_mcp / "Editor" / "Helpers" / "HttpEndpointUtility.cs"

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Confirm the Unity project exists and contains an Assets folder: ls <asset_project>/Assets.
  2. Pass --asset-project with the correct absolute path to your Unity project.
  3. If using the default, create or clone the TestProjects/AssetStoreUploads project first.

Example fix

# before
python tools/prepare_unity_asset_store_release.py --asset-project /path/to/some/folder --remote-url https://...

# after
python tools/prepare_unity_asset_store_release.py --asset-project /path/to/MyUnityProject --remote-url https://...
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

asset_project = Path(my_project_path).resolve()
if not (asset_project / "Assets").is_dir():
    raise SystemExit(f"{asset_project} is not a Unity project (no Assets/ folder).")

Prevention

When it happens

Trigger: Passing --asset-project to a folder that is not a Unity project (no Assets/ subfolder); the project hasn't been created yet; the path is misspelled or points at a parent directory. When --asset-project is omitted, the default repo_root/TestProjects/AssetStoreUploads is used — if that test project hasn't been scaffolded, this fires.

Common situations: The AssetStoreUploads test project was never created locally; pointing at the repo root instead of the project folder; the Unity project lives at a different path on this machine.

Related errors


AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13). Data as JSON: /api/errors/fffec743b932a104. Report an issue: GitHub.