Search Results for

    Show / Hide Table of Contents

    Install mods

    中文 | English

    Run this command at the repository root to replay the examples through the local Unity MCP.

    python Docs/Manual/manual/tools/tutorials.py run install-mods
    
    Click to expand MCP actionsClick to collapse MCP actions

    Prepare the teaching sample. The recipe provides ${variables}.

    {
      "variables": {
        "asset": "${fixture}/Tutorial_VehicleQueue.asset",
        "package": "${fixture}/Docs_${runId}_Package.asset",
        "pipeline": "${fixture}/Docs_${runId}_Pipeline.asset",
        "packageGuid": "66dc2d51-e05e-4e6d-9afd-7cc47e11a00a",
        "staged": "${fixture}/mods/Installs/Tutorial.modpack"
      },
      "calls": [
        {
          "tool": "invoke",
          "arguments": {
            "path": "static:UnityEditor.AssetDatabase/CreateFolder",
            "args": [
              "${fixtureParent}",
              "${folder}"
            ]
          },
          "expect": {
            "regex": "\\(String\\) [a-f0-9]{32}"
          }
        },
        {
          "tool": "invoke",
          "arguments": {
            "path": "static:UnityEditor.AssetDatabase/CreateAsset",
            "args": [
              "@static:UnityEngine.ScriptableObject/CreateInstance(ShanghaiWindy.Core.ModPackageData)",
              "${package}"
            ]
          },
          "expect": {
            "contains": "OK:"
          },
          "phase": "build"
        },
        {
          "tool": "invoke",
          "arguments": {
            "path": "static:UnityEditor.AssetDatabase/CreateAsset",
            "args": [
              "@static:UnityEngine.ScriptableObject/CreateInstance(ShanghaiWindy.Core.ModPackageBuildPiplineData)",
              "${pipeline}"
            ]
          },
          "expect": {
            "contains": "OK:"
          },
          "phase": "build"
        },
        {
          "tool": "inspect_set",
          "arguments": {
            "path": "asset:${package}/localizedModName/defaultName",
            "value": "Tutorial Package"
          },
          "expect": {
            "contains": "OK:"
          },
          "phase": "build"
        },
        {
          "tool": "inspect_set",
          "arguments": {
            "path": "asset:${package}/localizedDescription/defaultName",
            "value": "Documentation teaching package"
          },
          "expect": {
            "contains": "OK:"
          },
          "phase": "build"
        },
        {
          "tool": "inspect_set",
          "arguments": {
            "path": "asset:${package}/author",
            "value": "Documentation"
          },
          "expect": {
            "contains": "OK:"
          },
          "phase": "build"
        },
        {
          "tool": "inspect_set",
          "arguments": {
            "path": "asset:${package}/supportURL",
            "value": "https://doc.game.windyverse.net/"
          },
          "expect": {
            "contains": "OK:"
          },
          "phase": "build"
        },
        {
          "tool": "inspect_set",
          "arguments": {
            "path": "asset:${package}/guid",
            "value": "${packageGuid}"
          },
          "expect": {
            "contains": "OK:"
          },
          "phase": "build"
        },
        {
          "tool": "inspect_set",
          "arguments": {
            "path": "asset:${pipeline}/linkedModPackage",
            "value": "@asset:${package}"
          },
          "expect": {
            "contains": "OK:"
          },
          "phase": "build"
        }
      ]
    }
    

    Download a .modpack built for the platform where you run the game. Windows, Android and iOS each require a corresponding build.

    1. Find the mods folder

    On Windows, use the mods folder beside the executable you actually launch. On Android and iOS, use mods under the game's persistent data directory. In the iOS Files app, open the folder for the installed game.

    Click to expand MCP actionsClick to collapse MCP actions
    [
      {
        "tool": "inspect",
        "arguments": {
          "path": "static:ShanghaiWindy.Core.ResourceManager.ResourceConsts/GetModDir()/FullName"
        },
        "expect": {
          "contains": "mods"
        }
      }
    ]
    

    2. Stage the package

    Find or create Installs under mods. Copy the complete .modpack directly into it, keeping the original extension and archive intact.

    Click to expand MCP actionsClick to collapse MCP actions

    Build a Windows teaching archive and copy it to a scratch mods/Installs folder. A downloaded mod does not need to be rebuilt.

    [
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:UnityEditor.AssetDatabase/CopyAsset",
          "args": [
            "Packages/com.shanghaiwindy.coreresources/Editor/DocumentationSamples/preset-vehicle-queue/Tutorial_VehicleQueue.asset",
            "${asset}"
          ]
        },
        "expect": {
          "contains": "(Boolean) True"
        },
        "phase": "build"
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "asset:${pipeline}/linkedObjects/Add",
          "args": [
            "@asset:${asset}"
          ]
        },
        "expect": {
          "contains": "OK:"
        },
        "phase": "build"
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:UnityEditor.EditorUtility/SetDirty",
          "args": [
            "@asset:${pipeline}"
          ]
        },
        "expect": {
          "contains": "OK:"
        },
        "phase": "build"
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:UnityEditor.AssetDatabase/SaveAssets",
          "args": []
        },
        "expect": {
          "contains": "OK:"
        },
        "phase": "build"
      },
      {
        "tool": "modpack_plan",
        "arguments": {
          "pipeline": "${pipeline}"
        },
        "expect": {
          "equals": {
            "ok": true,
            "built": false
          },
          "contains": "\"vehiclequeue\""
        },
        "phase": "build"
      },
      {
        "tool": "modpack_build",
        "arguments": {
          "pipeline": "${pipeline}"
        },
        "expect": {
          "equals": {
            "ok": true,
            "archiveExists": true,
            "published": false,
            "installed": false
          }
        },
        "capture": {
          "archivePath": {
            "path": "archivePath"
          }
        },
        "phase": "build"
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:Frontend.Editor.ModPackageWorkshopMeta/WriteSidecar",
          "args": [
            "${archivePath}"
          ]
        },
        "expect": {
          "contains": ".modpack.json"
        },
        "capture": {
          "sidecarPath": {
            "regex": "\\(String\\) (.+)"
          }
        },
        "phase": "build"
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:System.IO.File/ReadAllText",
          "args": [
            "${sidecarPath}"
          ]
        },
        "expect": {
          "contains": "${packageGuid}"
        },
        "phase": "build"
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:System.IO.Directory/CreateDirectory",
          "args": [
            "${fixture}/mods/Installs"
          ]
        },
        "expect": {
          "contains": "DirectoryInfo"
        },
        "phase": "build"
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:System.IO.File/Copy",
          "args": [
            "${archivePath}",
            "${staged}"
          ]
        },
        "expect": {
          "contains": "OK:"
        },
        "phase": "build"
      }
    ]
    

    3. Restart and check

    Restart the game to scan the top level of Installs. Check whether the mod content is available. If it is missing, check the platform, file location and archive integrity, then consult the runtime log. The replay verifies a Windows teaching archive and its staging. The game completes installation during startup.

    Click to expand MCP actionsClick to collapse MCP actions
    [
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:System.IO.File/Exists",
          "args": [
            "${staged}"
          ]
        },
        "expect": {
          "contains": "(Boolean) True"
        },
        "phase": "build"
      }
    ]
    
    In this article
    Back to top Panzer War Document