Using external lightmaps in Unity 5.0


  • I have a project in an earlier version of Unity (before Unity 5), that was lightmapped outside of Unity. I want to upgrade it for Unity 5. 
  • I want to use external lightmaps for Unity 5.
  • If any of the lightmap's properties are changed via scripting and the scene is closed and re-opened again, the changes done before are not shown. 


In order for the external lightmaps to be shown in the scene, there have to be several parameter values assigned from the API by script first.
In Unity 4, these values were serialized automatically when you saved the scene; the properties of the lightmap were stored with the scene file. Yet, an automated process like hitting the bake button resulted in lots of changes that were highly likely to cause merge conflicts in the scene files.
In Unity 5, the properties that are needed to use external lightmaps are only serialized when there is a build. This helps to avoid the merge conflicts. Therefore, if you change one of the parameters and load the scene, the changes will not show.


To use external lightmaps, you need to have:

  • your external lightmap in a folder
  • a script that can create a LightmapSettings.lightmaps array in which you can store your external lightmaps (You could do this by creating a public data array type to be shown in the Editor and just drag your lightmap to the slot created).

Then you need to reference the object's renderer and assign the external lightmap by accessing the lightMap's array index (Renderer.lightmapIndex). Next, you should point at a specific area within it by using the scale & offset (Renderer.lightmapScaleOffset).
Finally, you will need to serialize all the properties' information in a file and read it to reset this information by using an Editor script every time the scene is opened. You could also do this through a script.

More Information

For more information see the links below:

This article applies to Unity versions 5.x


Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request


  • 1
    Igor Aherne

    Thanks. For anyone not sure where to "connect" the actual lightmaps array to your object, the article tells to just assign your texture array to LightmapSettings.lightmaps - I think it is scene-dependent

Please sign in to leave a comment.