Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

How to transfer realtime lightmaps?

Discussion in 'Scripting' started by SuperUltraHyper, Mar 17, 2019.

  1. SuperUltraHyper


    Sep 7, 2015
    I am trying to transfer a static lightmap from an object to a duplicate object.

    I essentially have 2 objects in my scene. One that I have baked lighting on and one that is inactive when baked but it also set to static. At at run time I want to use the same realtime lightmap on this object.

    This doesn't work.

    Code (CSharp):
    1. targetRenderer.realtimeLightmapIndex = sourceRenderer.realtimeLightmapIndex;
    2. targetRenderer.realtimeLightmapScaleOffset = sourceRenderer.realtimeLightmapScaleOffset;
    In the inspector, I can see the real time lightmap on the original object but not on the duplicate. Also, blend probes is not set to off and greyed out like the original.

    Any ideas?!

    Thanks in advance!