Hello.
I have a script that will get the tile at a specific position, replace it with null, which as a result will reveal a separate tilemap at this position. What I wish to do is that, for this tile that has just been revealed, is it possible to activate the tilemap collider for this specific tile only? If not, what would be the best way to generate a collider at this position, or for this tile. The relevant code I am using is shown below.
if(held == false) //if not holding a tile
{
newTile = Instantiate(tile, playerPosition.position, playerPosition.rotation); //instantiate a tile prefab at the player position
newTile.transform.parent = GameObject.Find("TileHolder").GetComponent<Transform>(); //tile is child of player
Vector3Int pos = new Vector3Int(Mathf.FloorToInt(playerPosition.position.x), Mathf.FloorToInt(playerPosition.position.y), Mathf.FloorToInt(playerPosition.position.z));
tilemap.SetTile(tilemap.WorldToCell(pos), null); //tile at the current player position is now replaced by a void tile
voidMap.SetColliderType(voidMap.WorldToCell(pos), Tile.ColliderType.Sprite);
Rigidbody2D newRb = newTile.GetComponent<Rigidbody2D>();
newRb.isKinematic = true;
held = true;
}