Hello, I’m working on a game which in the end size should be around 1,00000000 tiles, this is a big number.
I’m searching for way to load the tilemap part by part, here is what I tried so far.
I created small scenes, each scene consists of 100*100 grid.
I then load the adjacent scenes by the position of the player with LoadSceneAsync.
This works, but it leaves me with 10,000 scenes which even when empty require are around 1 hour per build.
I tought about saving the tiledata into files then loading the tiles by the data according to the position of the player, having no more then around 50 tiles loaded.
I was unable to do this, as I cant find a way to access the tileData or tileAnimationData.
Serializing TileBase does not seem to work.
I would love some suggestion about how to tackle this.
You could do a bit of work, and serialize a custom struct of all your data, and when you need to load, hot load it back into the Tilemap.
Perhaps you don’t need the entire TIleBase object in your level data file, maybe you really just need the position and tile art. Its conceivable you could encode the tile’s position into the order of the file itself, like a really simple 3x3 tile datafile could look like
“ABABBBAAA”, where each character represents a different art asset, and the x/y coordinates can be inferred by the index of the character, and the total width/height the file is representing.
I am not sure if I am missing out anything, but you could serialize the actual Tiles/Scriptable Tile type instead of TileBase or use these assets instead to build the Tilemap/s part by part.
I would still need the tile data, are you suggesting I save the tile data on the scriptable tile ? wouldn’t that be a waste as it is already saved on the tileData Object itself
The Tile should be the owner of the TileData as the Tile or Scriptable Tile determines the content of the TileData depending on the position of the Tile or the Tilemap used.
Could I ask how you are using TileData in your project?
What I tried to do so far is get all of the tiles via the
Tilemap.GetTilesBlock
method
this returns me a tileBase array, serializing and deserializing this results in an array of null data, so in short my question is why and what can I do to serialize this properly, you can also see a discussion about this in the github https://github.com/Unity-Technologies/2d-extras/issues/86