Reputation: 67
I got the problem when I wanted to change the bake type of light. In the inspector, I can choose realtime, baked or mixed and I cannot find a way to change it with a script. Can anyone help me? Thank a lot. By the way, I'm using unity 5.3.6
Upvotes: 1
Views: 246
Reputation: 125275
You can't change baking(bake type) with Unity 5.3.6. You will need Unity 5.5 version or above to do so. The answer below depends on the version you wish to update to.
For Unity 5.5, this can be done with the Light.lightmappingMode
property and LightmappingMode
:
Light light = GetComponent<Light>();
light.lightmappingMode = LightmappingMode.Mixed;
For Unity 5.6 and above, this can be done with Light.lightmapBakeType
and LightmapBakeType
:
Light light = GetComponent<Light>();
light.lightmapBakeType = LightmapBakeType.Mixed;
Upvotes: 1