For a mobile targeted game, I plan to create a tilemap which I estimate will be up to 50k triangles.
In order to optimize it, I decided to use very few textures.To further optimize it, I also want to bake the lightmap. However, I’m not sure if it is possible to do on a procedurally generated tilemap.
Because as far as I know, usually to bake the scene, they import all models and lights, mark them as static and then bake them. The problem is, I won’t have my map in the editor, it will be generated when the Awake() function is called. So I started to wonder if this is possible at all…
You can’t bake static lightmaps in the player, so you have to consider other options. One solution would be to bake smaller chunks of the level separately and piece them together using LoadLevelAdditive. Another would be to use Unity - Scripting API: Lightmapping.BakeMultipleScenes if you need shadows and GI between some level segments.
You can’t bake lightmaps at runtime. You could use realtime lighting and an ambient occlusion image effect. Both of those options are going to be expensive on mobile.
Light probes can be loaded additively. I’m doing that in this demo. I first unload the loaded scene with baked light probes then additively load a new scene with new baked light probes and it works fine. I know that doesn’t help with the original issue of how to bake proceduallly generated content but I just wanted to make the point.
Use the ‘E’ key to go through doors. The red and green room both have baked navmeshes and baked light probe groups.