Working with one way platforms between unity and tiled editor

One more question! I was wondering how object layers work, and how do i make some one way platforms, without needing to add manually the one way collision to a box in unity, is this something that i can avoid using object layers? i am currently using a tile layer for those, and manually painting my one way platforms there, and after that, putting the collisions in unity.


You can use Tiled’s collision editor to define the collisions. To distinguish these from regular full collisions, you can use a custom property on the collision object. If you’re using SuperTiled2Unity, you can use the unity:layer property either on the collision objects or on the layer the one-way tiles are on to tell ST2U to put those collisions on the Unity physics layer you use for one-way collisions.

ST2U also supports custom import scripts, which you can use for things like prefab replacement, and to process these one-way tile layers in whatever other way you want. You can use custom properties to communicate to your script that a given layer should be treated as one-way collision.

1 Like

i am not very familiar with using custom properties right now, we are using SuperTiled2Unity, so my question is where do i add the custom properties, to the one way tile? to the map? i don’t really know where to put the custom property and how to link it with unity, thanks!

btw, loving this forum! thank you so much for resolving my questions so fast! is there a discord server of tiled?? or can we talk on other media?

nevermind, seen the discord icon on top hahahah

The unity: custom properties are added in Tiled, and ST2U uses them.
According to this documentation, unity:layer can go many different things, so it’s up to you. If you want all of a particular tile’s collision to be one-way, no matter which layer that tile is on, then put it on the Tile in the tileset editor. If you want only particular collision objects to be one-way, put it on those collision objects in the collision editor. If you want the collision type of a tile to depend on the layer it’s on, then you’d put the property on the layer instead.

so if i want each tile to have this one way collision property, i should add this custom property unity:layer (oneway) to each tile right?

Yes, if you want those tiles’ collision to be one-way, add it to the Tiles. You’ll probably also need to do the same for any solid collision tiles, but for your solid collision physics layer.

Also, don’t forget this bit:

The layer name must exist in your project’s Tag Manager.

okay maybe this is a redundant question, the layer name is the string name that i put into the custom property right? and inside unity i should have a tag that its name is the same as the string name?

The “layer name” that goes into unity:layer in this case is the name of the Unity physics layer you want to use, not your tile layer in Tiled, just to be clear. And in Unity you need a tag with that name, yes.

okay i have now understanded this, now, in unity how do i tell him to separate every platform to have multiple collisions?

nevermind, this is incredible

this is just a unity question but do you know why my character sometimes collides from below even wit h the platform effector 2d?

Make sure you’ve checked the “one-way” checkbox on the platform effector 2D, and that no non-one-way collision components on your character use the same layer - perhaps you’ve accidentally set your all-way collision component to also collide with the oneway layer?

Beyond that, I can’t suggest anything, as I don’t know Unity at all.