From a39a5846833812fdb1af5bbcb53b7458f89ac2a6 Mon Sep 17 00:00:00 2001 From: in0finite Date: Wed, 26 Jan 2022 21:25:33 +0100 Subject: [PATCH] fix day-time manager --- .../Scripts/Behaviours/World/DayTimeManager.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Assets/Scripts/Behaviours/World/DayTimeManager.cs b/Assets/Scripts/Behaviours/World/DayTimeManager.cs index 7cf12674..f205c35b 100644 --- a/Assets/Scripts/Behaviours/World/DayTimeManager.cs +++ b/Assets/Scripts/Behaviours/World/DayTimeManager.cs @@ -53,7 +53,23 @@ namespace SanAndreasUnity.Behaviours.World public event System.Action onHourChanged = delegate {}; + +#if UNITY_EDITOR + [UnityEditor.InitializeOnLoadMethod] + static void InitOnLoad() + { + if (null == Singleton) + return; + Singleton.Init(); + } +#endif + protected override void OnSingletonAwake() + { + this.Init(); + } + + void Init() { m_originalLightColor = this.directionalLight.color; m_originalSkyboxExposure = RenderSettings.skybox.GetFloat(ExposurePropertyId);