Hi there. I can set and read a different globalIdentifier
after using something like _myTileLayer.SetTile(1, 1, 3);
but I can’t figure out how to update that tile’s texture in the game after doing this. I understand that the TiledMap renderer is geared towards rendering the whole file in one go, but surely this is possible… Any help is appreaciated, thank you!
Edit: I’ve figured out a solution. Unsure how deep the performance ramifications are but it seems fine for now. You have to just make a new TiledMapRenderer.
So a helper function to call could look like this:
public void UpdateTile(string layer, ushort x, ushort y, uint gid)
{
var selectedLayer = _tiledMap.GetLayer<TiledMapTileLayer>(layer);
selectedLayer.SetTile(x, y, gid);
_tiledMapRenderer = new TiledMapRenderer(GraphicsDevice, _tiledMap);
}
with _tiledMap
and _tiledMapRenderer
being used as they are in the documentation.