- Home /
Transparrent tiles not working with tilemap collider
Hi, I am creating a platformer game.
My issue is that Every time I use tiles that are transparent/translucent the tilemap collider won't generate a collider for that tile. I read online, and It seemed to be an issue with unity a couple of years ago. Just wondering if there is a simple fix or a way to manually set colliders for specific tiles.
Thanks in advance, Mats
Answer by TheKnightsofUnity · Apr 19, 2019 at 03:41 PM
Hello @mats1105 !
Because of how Unity generates default colliders for sprites, you have to manually add a collider to all transparent tiles. To do this, select the sprite with transparent tiles, click Sprite Editor button in the Inspector, then Custom Physics Shape:
Here, you can add new or modify existing colliders to match your preferences. From now on, all new tiles which use sprites with added/modified colliders should properly generate colliders.
CAUTION – if you already have tiles with transparent sprites in your project, their colliders might not have updated correctly. To fix this, select all tiles which use sprites with modified colliders, Change Collider Type from Sprite to None, then back to Sprite. This will force an update in the existing tiles.
We hope this will solve your problem! All the best,
The Knights of Unity
Answer by mlnczk · Apr 17, 2019 at 12:51 PM
You can always add box collider by hand as long as those tiles dont move or anything but better would be googling hard and fixing it with tile collider.
Your answer
Follow this Question
Related Questions
How to make 2D walls Transparent when the player or enemy is behind it. 1 Answer
Player Gets Stuck On TilemapCollider2D 0 Answers
How do I get collisions between Tilemap Collider 2d and a Kinematic Rigidbody 2d? 1 Answer
[Tilemap] Can you spawn a Prefab (with colliter) together with a tile when placing it? 0 Answers
Transparent sprite when it is overlapping another sprite on the same sorting order 0 Answers