- Home /
Collider doen't disappear on Tilemap
I'm trying to open doors in the rooms of my game so I remove the tiles on the tilemaps. The problem is that the collider of the removed tiles seems to stay on the tilemap so it's impossible to go out of the rooms.
public void ClearTiles(List<Board.DoorPos> doors, TileAsset tiles, int floor)
{
if (doors.Contains(Board.DoorPos.Up))
tilemap.SetTile(new Vector3Int(0, 7, 0), null);
if (doors.Contains(Board.DoorPos.Right))
tilemap.SetTile(new Vector3Int(8, 0, 0), tiles.Tiles[5 + (floor - 1) * 5]);
if (doors.Contains(Board.DoorPos.Down))
tilemap.SetTile(new Vector3Int(0, -6, 0), null);
if (doors.Contains(Board.DoorPos.Left))
tilemap.SetTile(new Vector3Int(-8, 0, 0), tiles.Tiles[10 + (floor - 1) * 5]);
}
SetTile with null in parameter should remove the tile and her collider but it doesn't. I precise that even if some tiles are replaced by others, they should have different collider but the problem is the same. Do I do something wrong or is that not normal ?
Comment
Your answer
Follow this Question
Related Questions
How do I make the Collider match the sprite? 2 Answers
Get individual tile under a Tilemap Collider 0 Answers
Access/Modify a specific tile of my tilemaps 0 Answers
Tile-based approach in Unity 1 Answer