Search Unity

tilemapCollider issue and updating Palettes

Discussion in '2017.2 Beta' started by Pearbook, Oct 10, 2017.

  1. Pearbook

    Pearbook

    Joined:
    Feb 3, 2013
    Posts:
    7
    I've been trying out the new Tilemap functions. So far I only have an issue with the Tilemap Collider and a question regarding the Palettes.

    So lets start of with the issue I'm having with the Tilemap Collider. So it looks like the Tilemap Collider makes a collider box for every tile you've assigned collision to in the Sprite Editor.
    At this moment I'm using it to make a little test 2D platformer, so I have an object with a Rigidbody2D and a collider. When I use a box collider, my player object gets stuck on the edges of the tiles (where a new collision box starts) and when I use a sphere or capsule collider, the player object moves kind of bumpy along the Tilemap Collider. I know this has been an issue for a long time with adjacent boxCollider2D's. With the Tilemap Collider I expected to have adjacent tiles with collision to have a combined collider rather than a collider per tile.
    So am I missing something or do I still have to deal with this weird and old bug?

    I didn't want to make an entire post for this so I'll just ask it together with my previous mentioned problem.
    So my question is: What is the best way to properly update a Pallete? I currently have a spritesheet with just a few tiles. So every time I add a tile, I have to re-slice my spritesheet into individual sprites and then recreate the Palette or manually add them. So I'm just wondering what the best way to do this is, without the fear of losing anything I created.
     
  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    826
    The TilemapCollider2D does not explicitly combine all of the collision shapes of the tiles. Instead, you can add on a CompositeCollider2D component to the Tilemap or Grid GameObject and enable "Used By Composite" on the TilemapCollider2D to combine the collision shapes. The benefit of having a separate CompositeCollider2D component is that you can add on other Collider2Ds and combine them all together at once.

    I guess the issue here is that when you drag in the updated Spritesheet to the Palette, it creates and overrides all the existing Tile Assets that you have created before, causing any used Tile Assets to become invalid. Will it be better if there was a prompt that asks if the existing Tile Assets should be overridden? For now, you may have to manually drop in the new Sprites.
     
    DumbSmith likes this.
  3. Pearbook

    Pearbook

    Joined:
    Feb 3, 2013
    Posts:
    7
    Thank you for the quick respond.

    Looks like the CompositeCollider2D is what I was looking for, Thanks. I just expected it more to be for physics related object rather than static levels in this case. I also thought that would add 2 colliders with 2 different functions, something I dont usually do.

    A prompt that something will be overridden is never a bad idea in my opinion. For now I decided to just fill my tilesheet with a colored checkerboard, that way the sprite editor will slice my entire sheet (it doesnt do that when it's fully transparent) and tiles I'll add later will already be in the Palette.
     
unityunity