SuperTiled2Unity icon indicating copy to clipboard operation
SuperTiled2Unity copied to clipboard

[PR] Export Complex Custom Type as Json String

Open yuwenhuisama opened this issue 3 years ago • 0 comments

This PR is related to #225

We found there are some bugs when we export custom properties with SuperTiled2Unity.CustomProperty where the original code cannot handle complex custom property (with nested structures).

This PR has fixed this bug by exporting all the property as json string, for example:

Custom property like this:

image

which will be exported in Unity SuperCustomProperties: image

PlaintInt
- Name: PlaintInt
- Type: int
- Value: {"type":"int","value":"0"}

TestProperty
- Name: TestProperty
- Type: TestClass
- Value: {{
    "type": "class",
    "realType": "TestClass",
    "Field1": {
        "type": "int",
        "realType": "int",
        "value": "0"
    },
    "Field2": {
        "type": "int",
        "realType": "int",
        "value": "0"
    },
    "Field3": {
        "type": "string",
        "value": "new String"
    },
    "SubClass": {
        "realType": "TestSubClass",
        "type": "class",
        "value": {
            "Value": {
                "type": "string",
                "realType": "string",
                "value": "the value"
            }
        }
    }
}

yuwenhuisama avatar Oct 16 '22 10:10 yuwenhuisama