I want to have optional layers that I don’t have to add to every level in Tiled. If the layer isn’t present in the XML, I would like to initialize it to a blank layer if possible. How do I do this?
Edit: this worked:
try {
blockExtras = tiledMap.GetLayer<TiledMapTileLayer>("BlockExtras");
} catch {
blockExtras = new TiledMapTileLayer("BlockExtras", tiledMap.Width, tiledMap.Height, 64, 64);
tiledMap.AddLayer(_blockExtras);
}