Can I use Custom Properties to set the Unity Layer?

I’m trying to get my collisions set up. I’ve used a Tile Layer called “Boundaries” to represent anything that will have collision. What I’d like to do is use a custom property that will pass to Unity when I import it there (using SuperTiled2Unity) and automatically set the Unity Layer to the value of my custom property. Is this possible?

Hi there @mack178. When you say Unity Layer do you mean layer (for physics) or Sorting Layer (for drawing)?

These are the custom properties to use in either case. Their value should match a name of a physics or sorting layers as set by your Tag Manager

  • unity:SortingLayer
  • unity:layer

If you want some more details on sorting layers with Tiled ans SuperTiled2Unity you may find this link useful: https://supertiled2unity.readthedocs.io/en/latest/manual/sorting.html

And if you’re talking about physics layers then putting the unity:layer custom property on the Tiled Layer will collect all collisions under the appropriate layer.

(D’oh! I see you were talking about physics/collisions after all)

Thanks for your response, Sean! I’ll give that a try when I get home from work.

Oh, one quick question: are custom properties case sensitive?

They are case-sensitive in Tiled, but I don’t know whether SuperTiled2Unity reads them as case-sensitive. Regardless, I’d make sure to match the casing they have in the documentation.