Page 1 of 1

Autosave changes to tilemap during runtime?

Posted: Sat Jul 25, 2020 10:30 pm
by Berncat
How would I go about saving changes to the tilemap at runtime using Autosave? I created a custom ES3Type for the level grid, tilemap renderer, and tilemap but changes still aren't being autosaved.

Re: Autosave changes to tilemap during runtime?

Posted: Sun Jul 26, 2020 7:36 pm
by Joel
Hi there,

Unity doesn't expose the fields required to serialise a Tilemap. Instead you would need to use Unity's TileMap.GetTilesBlock/SetTilesBlock to get the tile data, and use TileBase.GetTileData to get the data from the tile to be saved. You can then save this tile data and use it to reconstruct your TileMap.

All the best,
Joel