Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Adds supports for nested custom type importing.
Why?
Tiled supports nested custom objects, but when imported with SuperTiled2Unity the object is put in a property with type class and the values are lost. In place of nested custom types we could just define each field on each custom property, but it is easier to use nested custom properties.
For example
Now Character can be reused in many custom types in Tiled, but this data is not imported into Unity correctly.
How?
Adds a new CustomProperty type called ClassCustomProperty which contains a dictionary of values. When searching for a CustomProperty a new method GetCustomProperty is used which takes a key parameter. Regular CustomProperty ignore this parameter and return themselves, but the new ClassCustomProperty will search it's dictionary for the correct property.
Anything Else?
I'm aware this is not an ideal solution and the code is a little ugly. I saw on other PRs you are currently changing the code and converting this to use Unity's package manager system. I was unsure if this part of the code was affected. I'm more than happy to update the PR with any feedback or to change it to match your new code changes.
I think a better solution would have been to convert CustomProperty to some kind of holder class where the key is supplied and the holder finds the customer property. This would allow things like dictionary or list properties, but I do not think Tiled supports those things and it felt like overkill here.
I've also never used this XML library before so please let me know if there is a better way then calling Get Descendants.