Light Baking Automation in Unity 5November 5, 2015
Hello! Let’s talk about light baking in Unity 5 and automating the baking process.
We have all been there. Staring at a progress bar assuming that it must be done soon just to discover that it was nowhere near finished by the time that the process is finally done. You look at the clock and scold yourself for wasting time you could have spent catching up on sleep.
Light baking can take a lot of time. Generally these processes are offloaded using different computers or are done overnight but it usually requires someone to press a few buttons every now and then to move things along. In an attempt to get more baking done with less management, I created a simple script that takes care of this for any number of scenes you throw at it.
The idea is pretty simple: Tell Unity which scenes need to be baked and set it to bake. Below you can see an example of how it works.
The script takes care of pressing the bake button for every scene in the list you give it, and it will save the scene when done with the bake before moving to the next. While doing this, it reports on its progress with the amount of time taken per bake and at what time each bake finished.
I won’t assume that you know exactly how to install this script so let me illustrate this for you with this step by step explanation for the code illiterate.
1) Create an Editor folder at the root of your Unity project and create a new C# script called BakeScenes
2) Copy and paste the code below into the Bake Scenes script using a text editor of your choice
You will now have a Tools menu entry, as can be seen in the first .gif, in the menu bar of Unity where you can open the Bake Scenes window. Just add your scenes, hit bake, and…
Extend your gratitude by giving me a shoutout on Twitter at @Tinovdk or sharing this blog on social media of your choosing.
Thanks for reading all the way to the end! 🙂