- Home /
Question by
LasseWestmark · Mar 27, 2015 at 06:37 AM ·
renderinglightmapglobal illumination
Save custom lightmapScaleOffset in renderer
I have problems saving changes to lightmapScaleOffset / m_LightmapTilingOffset on my objects. The value is succesfully set and used when launching the scene in the editor, but the changes are removed when loading a new scene. Specifically, I do the following using a ScriptableObject:
private static void SetLightInfoOnObject(LightmapOffsetInfo lightmapOffsetInfo)
{
Renderer renderer = lightmapOffsetInfo.GetComponent<Renderer>();
renderer.lightmapScaleOffset = lightmapOffsetInfo.lightmapOffset;
EditorUtility.SetDirty(renderer);
}
I have tried setting lightmapScaleOffset on a normal MonoBehaviour Awake() aswell. This works well, when running the scene in the editor, but does not work when building the game for e.g. PC.
Is there any way to force Unity to save the changes to lightmapScaleOffset?
I'm currently using Unity 5.0f4, but the problem has been seen in 5.0f3 aswell
Comment