Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Different Collision Layers for different Tile.

Discussion in '2D Experimental Preview' started by Le_Tai, Nov 20, 2017.

  1. Le_Tai

    Le_Tai

    Joined:
    Jun 20, 2014
    Posts:
    442
    I'm making a platformer with water and land. I need them to belong to different collision layer so that the player controller can interact with them differently. Is this possible with the new system?
     
  2. Johaness_Reuben

    Johaness_Reuben

    Joined:
    Jan 27, 2016
    Posts:
    253
    You can use separate tilemaps and apply the colliders you need accordingly.
     
  3. Le_Tai

    Le_Tai

    Joined:
    Jun 20, 2014
    Posts:
    442
    That what I'm doing but it doesn't feel like that how it should be done.

    When using multiple tilemap, it is not apparent which map is being selected, if you draw on the wrong map you might not know it.

    Also, different tilemap can overlap, if you accidentally draw on top of another tilemap, it will lead to wrong behavior at runtime that isn't easy to tell. For example, in my case, if my water tile isn't transparent - just a blue square - and I draw it on top of a ground tile, at runtime the character might walk on top of the water and I will think there something wrong with my code. As the project gets more complicated, finding the overlapped tile will become extremely frustrating.

    Another problem is that rule-tile in different map can't interact with each other. What if you want the ground near water to turn in to sand automatically? This would be possible with the custom tile provided in 2d-extra repo, but only if the tiles belong to the same map.

    I'm only making a simple game, and I already run into problems with this kind of workflow; people who are making much bigger game might even have more problem with it.
     
  4. Connorses

    Connorses

    Joined:
    Jan 28, 2016
    Posts:
    15
    Being able to add prefabs to your tilesheet would likely solve this problem. Heck, it's so irritating I'm considering going back to GameMaker.
     
  5. Anderson_Antunes

    Anderson_Antunes

    Joined:
    Aug 10, 2015
    Posts:
    1
    Simply disable you current tilemap before add a new one.