Search Results for

    Show / Hide Table of Contents

    Build mods continuously

    中文 | 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 continuous-build
    
    Click to expand MCP actionsClick to collapse MCP actions

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

    {
      "variables": {
        "package": "${fixture}/Docs_${runId}_Package.asset",
        "pipeline": "${fixture}/Docs_${runId}_Pipeline.asset",
        "packageGuid": "5cd6ae9b-1231-5334-90e0-87a3974c3d4a",
        "sight": "${fixture}/TutorialSight.asset",
        "gun": "${fixture}/TutorialSightGun.asset",
        "manifest": "${fixture}/pipeline.json",
        "destination": "${fixture}/Output",
        "expectedArchive": "${destination}/StandaloneWindows64_Docs_${runId}_Package.modpack",
        "rawDestination": "${fixture}/RawOutput",
        "otherPlatformDestination": "${fixture}/AndroidOutput"
      },
      "calls": [
        {
          "tool": "invoke",
          "arguments": {
            "path": "static:UnityEditor.AssetDatabase/CreateFolder",
            "args": [
              "${fixtureParent}",
              "${folder}"
            ]
          },
          "expect": {
            "contains": "(String)"
          }
        },
        {
          "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"
        }
      ]
    }
    

    Official mod repository

    1. Open Build modpack in the mod repository's GitHub Actions. Enter the affected packs and target platform.
    2. For a verification build, use publish=none and leave release empty. The workflow trims dependencies, fetches matching LFS objects, builds, and verifies the result.
    3. Download the .modpack and matching .modpack.json from that run's artifacts. Check the platform, GUID, and version.

    Local build manifest for an SDK project

    1. In ModPackageBuildPiplineData, reference ModPackageData and the assets to package.
    2. Add an entry to infos in the JSON file. List the pipelines in modNames. A pipeline directly in Assets/ModManager can use its bare name. For subfolders, enter the full Unity asset path from the project root, including .asset.
    3. List output directories by target in copyInfo. An Android build uses the Android row. A StandaloneWindows64 build uses the Windows row. Create the directories before building. Use isPackage=true for a .modpack archive. Use false to copy the built resource folder for a workflow that takes unpacked resources. Keep isCleanDstFolder=false when several pipelines share an output directory. With true, each pipeline clears its destination before copying.
    {
      "infos": [
        {
          "modNames": [
            "BuildPipline-Lua-ModeRes",
            "Assets/ModManager/Vehicles/BuildPipline-Vehicles.asset"
          ],
          "copyInfo": [
            { "platform": "Android", "dstDir": "Build/Ship/Android" },
            { "platform": "StandaloneWindows64", "dstDir": "Build/Ship/Windows" }
          ],
          "isPackage": true,
          "isCleanDstFolder": false
        }
      ]
    }
    
    1. Call ShanghaiWindy.Editor.Utility_BuildPipline.BuildPiplineManifest(path) from your editor entry point and check the corresponding directory. Use Frontend.Editor.ModPackageWorkshopMeta.WriteSidecar(archivePath) to create the matching .modpack.json. Verify the platform, GUID, and version.
    Click to expand MCP actionsClick to collapse MCP actions
    [
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:UnityEditor.AssetDatabase/CreateAsset",
          "args": [
            "@static:UnityEngine.ScriptableObject/CreateInstance(ShanghaiWindy.Core.UserSightData)",
            "${sight}"
          ]
        },
        "expect": {
          "contains": "OK:"
        }
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:UnityEngine.JsonUtility/FromJsonOverwrite",
          "args": [
            "{\"displayName\": {\"defaultName\": \"Tutorial Sight\"}, \"guid\": \"d326f481-ac40-53f5-8d3c-2051b6713301\", \"drawCentralLineVert\": false, \"drawCentralLineHorz\": false, \"ballistics\": [{\"defaultVelocity\": 1430, \"defaultGravity\": 9.8, \"dynamicGravity\": true, \"dynamicVelocity\": true, \"crosshairDistances\": [{\"range\": 400, \"number\": 4, \"notchSize\": 2}], \"crosshairHorRanges\": [{\"range\": 10, \"number\": 10, \"notchSize\": 1}]}], \"lines\": [{\"points\": [{\"x\": 0.4, \"y\": 0.5}, {\"x\": 0.6, \"y\": 0.5}], \"thickness\": 2, \"isRelativeSize\": true}]}",
            "@asset:${sight}"
          ]
        },
        "expect": {
          "contains": "OK:"
        }
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:UnityEditor.EditorUtility/SetDirty",
          "args": [
            "@asset:${sight}"
          ]
        },
        "expect": {
          "contains": "OK:"
        }
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:UnityEditor.AssetDatabase/SaveAssets",
          "args": []
        },
        "expect": {
          "contains": "OK:"
        }
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "asset:${pipeline}/linkedObjects/Add",
          "args": [
            "@asset:${sight}"
          ]
        },
        "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": "invoke",
        "arguments": {
          "path": "static:System.IO.Directory/CreateDirectory",
          "args": [
            "${destination}"
          ]
        },
        "expect": {
          "contains": "DirectoryInfo"
        }
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:System.IO.Directory/CreateDirectory",
          "args": [
            "${rawDestination}"
          ]
        },
        "expect": {
          "contains": "DirectoryInfo"
        }
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:System.IO.File/WriteAllText",
          "args": [
            "${manifest}",
            "{\"infos\": [{\"modNames\": [\"${pipeline}\"], \"copyInfo\": [{\"platform\": \"StandaloneWindows64\", \"dstDir\": \"${destination}\"}, {\"platform\": \"Android\", \"dstDir\": \"${otherPlatformDestination}\"}], \"isPackage\": true, \"isCleanDstFolder\": false}, {\"modNames\": [\"${pipeline}\"], \"copyInfo\": [{\"platform\": \"StandaloneWindows64\", \"dstDir\": \"${rawDestination}\"}], \"isPackage\": false, \"isCleanDstFolder\": false}]}"
          ]
        },
        "expect": {
          "contains": "OK:"
        }
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:ShanghaiWindy.Editor.Utility_BuildPipline/BuildPiplineManifest",
          "args": [
            "${manifest}"
          ]
        },
        "expect": {
          "contains": "OK:"
        }
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:System.IO.File/Exists",
          "args": [
            "${expectedArchive}"
          ]
        },
        "expect": {
          "contains": "(Boolean) True"
        }
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:Frontend.Editor.ModPackageWorkshopMeta/WriteSidecar",
          "args": [
            "${expectedArchive}"
          ]
        },
        "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.Path/GetFullPath",
          "args": [
            "${expectedArchive}"
          ]
        },
        "expect": {
          "contains": ".modpack"
        },
        "capture": {
          "archivePath": {
            "regex": "\\(String\\) (.+)"
          }
        }
      },
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:ShanghaiWindy.Core.AssetBundleManager/LuaEnv/DoString",
          "args": [
            "local io = CS.System.IO\nassert(io.Directory.GetFiles('${rawDestination}', '*.usersight', io.SearchOption.AllDirectories).Length == 1)\nassert(io.Directory.GetFiles('${rawDestination}', '*.modpack', io.SearchOption.AllDirectories).Length == 0)\nassert(not io.Directory.Exists('${otherPlatformDestination}'))\nreturn 'Windows archive and raw output used their matching target; Android was skipped'\n",
            "docs-build-raw",
            "null"
          ]
        },
        "expect": {
          "contains": "Android was skipped"
        }
      }
    ]
    

    Run from the command line

    The old DoBuildPiplineManifest -config entry has changed. Use a parameterless static Editor method as Unity's -executeMethod entry point, read the manifest path there, and call BuildPiplineManifest(path). Pass the Unity executable, project root, target platform, entry method, and log path. On Windows, you can use PowerShell or Git Bash. See the complete command in self-hosted Jenkins builds.

    In this article
    Back to top Panzer War Document