void OnEnable() { if (!m_isAwake) { return; } UpdateKeywords(true); UpdateStaticUniforms(); if (instance && instance != this) { Debug.LogErrorFormat("Unexpected: AtmosphericScattering.instance already set (to: {0}). Still overriding with: {1}.", instance.name, name); } instance = this; if (SkyManager != null) { if (Sun == null) { Sun = SkyManager.SunObj; } } }
void OnDisable() { UpdateKeywords(false); //v3.4 //void OnDisable() { //v4.2 - only sun is used !!! //if (SkyManager != null) { // if (SkyManager.SUN_LIGHT != null && SkyManager.SUN_LIGHT.GetComponent<Light> ()) { // SkyManager.SUN_LIGHT.GetComponent<Light> ().RemoveAllCommandBuffers (); // } //} else { if (Sun != null && Sun.GetComponent <Light> ()) { Sun.GetComponent <Light> ().RemoveAllCommandBuffers(); } if (SkyManager != null) { if (SkyManager.SUN_LIGHT != null && SkyManager.SUN_LIGHT.GetComponent <Light> ()) { SkyManager.SUN_LIGHT.GetComponent <Light> ().RemoveAllCommandBuffers(); } if (SkyManager.MOON_LIGHT != null && SkyManager.MOON_LIGHT.GetComponent <Light>()) { SkyManager.MOON_LIGHT.GetComponent <Light>().RemoveAllCommandBuffers(); } } //} //} if (instance != this) { if (instance) { // Debug.LogErrorFormat("Unexpected: AtmosphericScattering.instance set to: {0}, not to: {1}. Leaving alone.", instance.name, name);//v4.8 } } else { instance = null; } }