I am developing a game which includes drilling of a formation. The formation is consisted of millions of tiles. So due to performance issues I decided to create the tiles on the go and delete the previous unwanted tiles.
I use a dictionary which stores all the tile positions and their state and by using tilemap.SetTile
I use null to remove the tile or to the actual tile to create it. The problem is, because I have to create or remove a big area of tiles at once, when i do this my game freezes for a while. I tried to do it in another thread, but it is not allowed by Unity.
How can I cope with this issue? Is there another good technique so the game can run smoothly?
P.S.: I tried tilemap.SetTiles
as well but the difference in very small. The problem is still there!
Thanks in advance!