RB.MapChunkSize
Property - Static Read Only
Type
Vector2i
Description
The tilemap chunk size, as given in IRetroBlitGame.QueryHardware. The size is specified in tile counts.
A tilemap is internally divided up into chunks. When picking a non-default chunk size in IRetroBlitGame.QueryHardware there are several things to consider: - Each chunk has some drawing overhead, the more chunks visible on screen the slower the tilemap will render.
- Large chunks have greater chance to be only partially visible on screen and cause some unnecessary overdraw. This will eventually be optimized by the GPU, but some performance loss will happen.
- Whenever one or more tiles are updated in a chunk the entire chunk must be recreated and uploaded to the GPU. This is a batched operation, the chunk is not uploaded until it is next rendered.
With these points in mind the general rule of thumb is that the larger your game resolution the larger the tilemap chunk size should be.
Example
int GetTotalMapChunks() { var mapSize = RB.MapSize; var chunkSize = RB.MapChunkSize;
return (mapSize.width / chunkSize.width) * (mapSize.height / chunkSize.height); } |
See Also
IRetroBlitGame.QueryHardware
See Docs
Features - Tilemaps
|