Tilemap Colliders not working with custom tile
I have a simple scene with a player with gravity and a tilemap with a tilemap collider. I also have a custom Tile named ground. The colliders on the ground seems to not work! I also can't see a green outline in the editor, so i think the issue is with the tiles themselves.
I have EXACTLY SA$$anonymous$$E problem you have. Can anyone help us?
Thanks
LOL and then there is me who just yeeted my Tilemap Collider 2D sometime in the past. In hindsight I think I did it to avoid a AABB error hell but whatever
Answer by leonieponsioen · Jun 21, 2019 at 11:40 PM
I've had this problem, I extended the Tile class for my custom tile and overriden the GetTileData function. I forgot t o call the base function, after doing so it works
public override void GetTileData(Vector3Int location, ITilemap tilemap, ref TileData tileData)
{
base.GetTileData(location, tilemap, ref tileData);
/// rest of your code
}
Answer by EvasiveBastrd · Jan 29, 2019 at 03:06 AM
I think there is a bug. After adding the Tilemap Collider2d I had to change the rendering layer of the tilemap, I was then able to switch it back to my original setting and it worked like a charm.
If anyone else experiences this and they know how to file a bug report please do, I would but I'm still not sure I had nothing to do with my issue.
I have both of my tilemaps set to Order in layer: 0, and Sorting layer: default. The object has a rigidbody and same order in layer and sorting layer and it's just falling right through. Did you just randomly change the order in layer on your renderer? Or the sorting layer? Did you save and close and reopen? I changed all kinds of layer numbers and it doesn't seem to be fixing my issue.
Yes, all I did was change the sorting layer then I set it back to default. If you can see the green collision shapes then make sure your collides aren't set to 'Is Trigger', also check your collision layers in the project settings. Other than that I can't really help for I'm a noob at Uinty.
Good luck and don't give up. It's midnight here, tomorrow I will try to recreate the scenario and try to confirm a solution.
Answer by ryanlin138 · Mar 05, 2020 at 01:09 AM
I had this problem and fixed it by setting the collider type. (I'm extending TileBase, not Tile)
tileData.colliderType = Tile.ColliderType.Sprite;
Your answer
Follow this Question
Related Questions
Ignore collisions with water if ground above water 0 Answers
Rotate tilemap collider -1 Answers
2d Tilemap collidor not working 0 Answers
Player slips through the tilemap collider 2D. 0 Answers
Rule Tiles across different (ground/!ground) tilemaps 0 Answers