Summary
If you made it through this short tutorial, you should have a basic understanding of how this tools works and how you can interact with it. At this point, I would suggest to have a look at the API documentation to see what else it can do or to test it out on your own by looking at the example scenes provided in the TilemapExtended asset folder.
If you have any questions, issues or suggestions, feel free to send me a message!
Additional thoughts
Don't want to use data storage but want access to grid methods?
If you don't wish to use TilemapExtended for data storage or if you have already implemented your own storage but still need access to useful grid utility methods such as neighbours, rings etc. just use the static utility classes instead:
Dictionary as storage? A note on performance
Conventional arrays are usually considered superior when it comes to storing sequential data such as spatial grid cells for several reasons. During early testing, I compared the performance of a 1D array implementation vs storing data in a dictionary in several test cases. The dictionary performed more or less on the same level for up to tens of thousands of tiles. For that reason, I decided to go with the more flexibel dictionary storage.
Save memory using the uniform CellData property
Storing thousands of individual object instances for thousands of tiles can consume significant amounts of memory. In this case, consider declaring cell data objects as uniform, i.e. have them all use one single CellData reference if:
- Their data will not change at all: Everything that's static (static scenery, rocks that cannot be destroyed etc.)
- Their data will change as a group: Tree tiles that all change leaf color based on a season at the same time
Edit CellData directly vs extending CellData
A valid thought might be to edit CellData
directly instead of extending it.
This approach would work as well so here are some pro's and con's, depending on your situation:
Modifying CellData | Extending CellData |
---|---|
Pro: -Fast -Easy -No need to typecast when getting cell | Pro: -Abstraction and clear separation -Reusable -Overview |
Con: -No abstraction -Not reusable | Con: -Setup time -Need to typecast |