My Unity app animates the scene's Skybox Material Exposure property over time (based on audio). The Material asset in my project file has Exposure=1 (initial value). This works great.
When I play the app inside Unity:
- Before play, I select the Material in Project (to see what's happening),
- Play the app in Unity,
- As soon as app starts, the Material's Exposure is set to a very low value (as expected),
- The Skybox Exposure animates as expected (i.e., Skybox is changing to the music),
- The Exposure value (in Inspector) does not change after the first change at start (#3), during the play (seems odd),
- When I exit play mode, the Exposure (in Inspector) is set to the last value during play (which is not displayed in the Inspector while running).
==> I expected the Material to return to its pre-play values after exiting.
IMPORTANT: If I try this same experiment with say a Sphere radius (no scripting though), and I manually change the sphere's radius while playing, when I exit play mode it resets (as expected) to its original pre-play value.
Clearly, I am missing something very core to Unity. I've read everything I can find & still lost. (Wondering if the issue is default Hideflags on the scene's skybox or something similar.)
Scene controller script that changes skybox.material.exposure each frame:
public class AnimateSkyboxFromAudio : BaseAnimateFromAudio {
protected override void Start() {
base.Start ();
}
protected override void MyUpdate () {
float rms = GetAttrByName (AudioAnalyzer.RMS);
RenderSettings.skybox.SetFloat ("_Exposure", rms * 5);
}
}