SuperTiled2Unity icon indicating copy to clipboard operation
SuperTiled2Unity copied to clipboard

SuperCustomProperties and their Unity effects persist over object prefab replacement

Open vvnurmi opened this issue 3 years ago • 2 comments

Until now, SuperObjectProperties were lost when a Tiled object got replaced by a prefab. This also meant that the special properties unity:tag and unity:layer didn't set the tag or layer of the new prefab instances.

This pull request fixes that.

vvnurmi avatar Apr 15 '22 17:04 vvnurmi

There's a null reference problem in the PR. Fix incoming.

vvnurmi avatar Apr 15 '22 19:04 vvnurmi

Added the fix to null reference when importing Tiled assets.

Also changed it so that prefab replacements don't get to inherit the Unity layer from their parent.

  • They didn't do it before
  • Inheriting the parent's layer overrides any layer set in the prefab
  • Inheriting the layer from the parent is a feature used for objects that have a super tile(?)

The function AssignUnityLayer got a nasty-looking bool parameter, which could perhaps be better refactored out by splitting the function into two parts, one assigning the Unity layer from super properties, and the other inheriting the layer from the parent if a layer isn't set already. 🤔

vvnurmi avatar Apr 15 '22 19:04 vvnurmi