How to update visually after using SetTile()

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.

I updated this to set a flag so the new renderer can be created at the appropriate time. I set the check in the draw function right before it draws but maybe there’s a better spot for it:

public bool tileUpdated;
public void UpdateTile(string layer, ushort x, ushort y, uint gid)
{
    var selectedLayer = _tiledMap.GetLayer<TiledMapTileLayer>(layer);
    selectedLayer.SetTile(x, y, gid);
    tileUpdated = true;
}
Draw() {
    if (tileUpdated)
    {
        _tiledMapRenderer = new TiledMapRenderer(GraphicsDevice, level.tiledMap);
        tileUpdated = false;
    }
    _tiledMapRenderer.Draw();
}

@craftworkgames From a memory perspective, is what I’m doing here kosher? I’m not running into any obvious problems yet, but I’m curious if you could enlighten me as to what might be happening memory wise when I’m making a new renderer object whenever I need one (and writing over the variable). Is there a different approach you might recommend?