We’ve got 30 levels in our game, and we want to display all the levels on the buttons in the main menu.
We don’t want to take a screenshot of all the tilemaps, as we’ll quickly use more and more texture memory, plus, they won’t update if we change the look of the tiles.
I could dynamically spawn GUI images, one for every tile on every level, but it seems rather inefficient.
I interpret this as you wanting to somehow show thumbnail representations of your levels on buttons, and all 30 of them. Two possible approaches.
Create 30 game objects and simply render the tilemaps as is. They might need their own render predicate to get sorting right etc.
Generate thumbnails offline. It should be fairly easy to automate this with a python script that reads the tilemaps and atlases/textures, builds and resizes thumbnails and finally generates an atlas.
Thanks! #1 sounds pretty neat - How do I set up a render predicate, and how do I make sure that those game objects in particular are rendered on top of the GUI?
(I don’t want to do #2, since it will use lots of memory)
Each thumbnail would be slightly below 256x256, given 30 thumbnails, which later on needs to be expanded to 54, we’d need a texture/atlas of 2048x2048 containing the thumbnails only.
It sounds quite a lot to me, but, then again, I’m not much of an experienced mobile developer. I’m presuming almost everything is expensive/too much
How will the tilemaps handle aspect scaling?
Even if I render them on top of the buttons, they need to be a perfect fit, but I presume they’re not in the same space, right?
I believe I’ve set up the render predicate and created the material with the matching tag. However, I can’t seem to find a way to set the material of a tilemap from code, and I don’t want to edit the original ones, since they need the default render order / default tilemap material once in-game.
You could also have two different tags on the same material rendered with different predicates, so you could copy the built-in tilemap material and add the tag “thumbnail” to it and then render that with the predicate.
Another option would be sending a message to the renderscript that would se a variable telling it wether to render tilemaps normally or as thumbnails.