private void OnDestroy()
        {
            TweenFactory.Clear();
            WeatherMakerObjectExtensions.Clear();

            // remove lightning bolt lights from the light manager
            if (Application.isPlaying && WeatherMakerLightManagerScript.Instance != null && WeatherMakerThunderAndLightningScript.Instance != null)
            {
                WeatherMakerThunderAndLightningScript.Instance.LightningBoltScript.LightAddedCallback   -= LightningLightAdded;
                WeatherMakerThunderAndLightningScript.Instance.LightningBoltScript.LightRemovedCallback -= LightningLightRemoved;
            }

            WeatherMakerScript.ReleaseInstance(ref instance);
        }
Exemple #2
0
        private void OnDestroy()
        {
            TweenFactory.Clear();
            WeatherMakerObjectExtensions.Clear();

#if UNITY_EDITOR
            Instance = GameObject.FindObjectOfType <WeatherMakerScript>();
#endif

            Camera.onPreCull   -= CameraPreCullWrapper;
            Camera.onPreRender -= CameraPreRenderWrapper;

            if (WeatherMakerLightManagerScript.Instance != null)
            {
                // wire up lightning bolt lights to the light manager
                LightningBoltScript.LightAddedCallback   -= LightAdded;
                LightningBoltScript.LightRemovedCallback -= LightRemoved;
            }
        }