Prefab Baker

What is the Prefab Baker?

The idea of prefab baker is to allow adding prefabs with baked lightmaps during play into the active scene.

How is done?

Unity will bake lightmaps for the current active scene, the resulted image files will be moved to the target prefab folder. The prefab baker script in the prefab object will store those lightmaps references relative to each rendered component inside the prefab alongside the index, UV's scale offset. Once the prefab is added to the scene it will scan the current existing lightmaps and add any missing lightmaps.


  • Make sure the lighting settings of your bake scene will match your level scene ( same skybox light source and directional lights if any )
  • Quick bake was made for rapid lightmap prototyping which will use low quality for quick bake preview ( using this potions will not override the current scene lighting settings )
  • When baking multiple prefabs their lights will effect each others lightmaps if they are spaced closely together, its recommended to bake one prefab at a time to avoid this result or place the prefabs far away from each other.
  • Adding the script to an object which is not a prefab and clicking bake, will automatically convert the game object into a prefab and save it in the same folder as the current open scene
  • By default the lightmaps export folder will be located in Resouces/Lightmaps.
  • The lightmaps will be copied to a new folder inside the selected target folder. To avoid lightmap collisions, make sure all baked prefabs have unique names across the project.

How to use Prefab baker in ARMOD?

At the first you need install the Prefab Bake from our registry. We can open the package manager panel and switching the registry to My Registry ,then you can see the ARMOD Rendering Assistant in the package manager panel. Prefab Bake was include in it, so we need install it! Hit the Install button to install this package.
When you are installed ARMOD Project Wizard, ARMOD Rendering Assistant package will be installed automatically.

Baking setup

Create a new scene for baking. Selected the Empty(Built-in) Scene tempalte to create.
Create three Empty GameObjects and name them: Chair (name as you like), Meshes, Lights. Then put Meshes and Lights under the Chair and make them child objects of Chair.
Drag and Drop our AR virutal object from Assets to Hierarchy. And let our AR virutal object become child object of the Meshes. And place all lights under the Lights node.
Okay! It's a nice structure. Now we should add the Prefab Baking script for our Chair gameobjct.
This is how to add script flow:
  1. 1.
    Selected the Chair gameobject
  2. 2.
    Look at theInspector panel
  3. 3.
    Click the Add Component button
  4. 4.
    typing the Prefab Baking to search
  5. 5.
    Add Prefab Baking for our Chair gamebject
Prefab Baking script need put it on Root GameObject

Start Baking

Now we have completed the setup. Click the Open Baker button to display baking setup panel. We can see the error in the window. Now we need click Change button to reset the saved Lightmaps folder path.
We recommend that you set the saved path to the ARMOD Project Artwork folder
Before baking, we should save our Chair in Assets to make it a Prefab! Although Prefab Baker will help me save it as Prefab under the storage Lightmaps path. And save current scene, its important! Click Bake button to start baking!
If the Automatically clean up the scene lightmap is checked, the "Prefab Bake" will clean up all the baking in the current preview. But this does not clear our data, but just preview the data
Automatically clean up the scene lightmap checked
If you want to adjust more baking parameters, you can go to Lightmap to adjust. After adjusting the parameters, please click Bake on the Prefab Bake panel.
Last modified 6mo ago