Search Results for

    Show / Hide Table of Contents

    Import a DIY map into the Unity project

    中文 | 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 diy-map-project-import
    

    1. Prepare the assets and the YAML file

    1. Open the public SDK's UnityProject using project setup. Maintainers with access to official production assets use Panzer-War-Mods/Projects/Maps. Map asset sources
    2. A DIY save finds objects by itemGuid. The official Maps project already declares the DIY packages in its manifest. For the public SDK, if you have the corresponding local UPM packages, use Window → Package Manager → + → Add package from disk and select each package.json. Check that their assets and configuration appear under Packages in Project.
    3. Find the .yaml in the game's save directory and make a copy for editing. The source assets need the same GUIDs used by the save.

    2. Load the base scene and import the map

    1. Open Framework → 1. Editor Tools → 05. DIY Workshop → DIY Map Edit. Choose Load Base Asset and confirm to enter Play in the base playground.
    2. Wait for the game environment to finish loading. Select the file in the YAML picker, then click Load DIY Map from Yaml. Inspect the scene and DIYMapConfig after the import finishes.
    3. If an object is missing, find the reported itemGuid in the Console. Check that the package containing that GUID is available before continuing. Keep existing GUIDs so saves can resolve their objects.
    Click to expand MCP actionsClick to collapse MCP actions

    Round-trip the map name and itemGuid through the editor's YAML parser. Scene import requires the loaded base assets.

    [
      {
        "tool": "invoke",
        "arguments": {
          "path": "static:ShanghaiWindy.Core.AssetBundleManager/LuaEnv/DoString",
          "args": [
            "local typed = CS.ShanghaiWindy.Core.Data.DIYMapUserDefined\nlocal util = CS.ShanghaiWindy.Core.Utils.YamlUtil\nlocal decode = xlua.get_generic_method(util, \"DeserializeYaml\")(typed)\nlocal encode = xlua.get_generic_method(util, \"SerializeYaml\")(typed)\nlocal input = [[\nguid: 2f7d6e7d-b518-4f6f-9c2d-1d2c728f82da\ndefinedName: Tutorial Town\nrules:\n- ruleGuid: 167798a3-6d87-4ec8-a701-ae59775eb7ce\n  itemGuid: 08951884-e54b-4c7e-a449-9f2ef826cbc1\n  itemJson: '{}'\n]]\nlocal map = decode(input)\nlocal restored = decode(encode(map))\nassert(restored.definedName == \"Tutorial Town\" and restored.rules.Count == 1)\nassert(restored.rules[0].itemGuid == \"08951884-e54b-4c7e-a449-9f2ef826cbc1\")\nreturn \"DIY YAML round-trip passed\"",
            "manual-validate",
            "null"
          ]
        },
        "expect": {
          "contains": "DIY YAML round-trip passed"
        }
      }
    ]
    

    3. Save or package your changes

    If you only changed positions, set the output name and folder and click Save Map as Yaml. Enter the name without an extension. The tool writes <name>.yaml. To publish a full mod scene, follow the map wizard to prepare its scene, preview, and build.

    In this article
    Back to top Panzer War Document