Search Results for

    Show / Hide Table of Contents

    Build for multiple platforms

    中文 | 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 multi-platform-build
    
    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-7cc47e11a00b"
      },
      "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"
        }
      ]
    }
    

    Build a separate .modpack for each target. The game requires AssetBundles built for the platform it runs on.

    Prerequisites

    • Install the matching Unity version and platform modules.
    • The project is registered in GameHub. If it is not, click Add Path in GameHub and point it at that Unity project.
    • Local file: dependencies (adjacent UnityProject / Packages layout) resolve correctly, and the SDK dependency matches the build for this platform.

    Create the soft-linked project

    1. In GameHub, select the target platform you want to build for.
    2. GameHub creates a soft-linked project for that platform; click Copy to copy its path.
    3. Open Unity Hub, click Add project from disk, and enter the path copied in step 2.
    4. Click the version, change Current Platform to the platform of the project you created, make sure the name matches, then click Open.
    5. After the project opens, check the target in File → Build Settings and wait for import to finish.

    GameHub's linked projects share source assets. Each platform keeps its own Library. Follow the GameHub and Unity Hub steps manually, then use MCP to check the target of the open project.

    Click to expand MCP actionsClick to collapse MCP actions

    The sample checks the currently selected Windows target. Choose the required build platform in the Editor.

    [
      {
        "tool": "inspect",
        "arguments": {
          "path": "static:UnityEditor.EditorUserBuildSettings/activeBuildTarget"
        },
        "expect": {
          "contains": "(BuildTarget) StandaloneWindows64"
        }
      }
    ]
    

    Build and validate each platform separately

    1. For that platform, run Build Linked Objects to AssetBundle on the BuildPipeline.
    2. Then run Package Mod Now on the associated ModPackage.
    3. Keep the generated .modpack and its .modpack.json sidecar. Check the platform, Unity version, resource manifest and metadata, then test it in the game on that platform.

    After changing resources or switching platforms, repeat the first two build steps. The replay below verifies a Windows teaching package. Check Android and iOS builds on their corresponding platforms.

    Click to expand MCP actionsClick to collapse MCP actions

    Local MCP builds a Windows teaching package and checks its archive, manifest and sidecar.

    [
      {
        "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"
      }
    ]
    
    In this article
    Back to top Panzer War Document