From f8f37aa011b53afcfaa6a2fadf5de513109d8f0d Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sat, 5 Feb 2022 03:28:37 -0800 Subject: [PATCH] IAddComponentOnStart: some of these can be destroyed right after running --- QSB/EyeOfTheUniverse/MaskSync/MaskManager.cs | 2 +- QSB/RespawnSync/RespawnManager.cs | 2 +- QSB/SatelliteSync/SatelliteProjectorManager.cs | 2 +- QSB/TimeSync/TimeSyncUI.cs | 10 +++++----- QSB/Utility/DebugCameraSettings.cs | 3 ++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/QSB/EyeOfTheUniverse/MaskSync/MaskManager.cs b/QSB/EyeOfTheUniverse/MaskSync/MaskManager.cs index 015742db..d646a8b9 100644 --- a/QSB/EyeOfTheUniverse/MaskSync/MaskManager.cs +++ b/QSB/EyeOfTheUniverse/MaskSync/MaskManager.cs @@ -16,7 +16,7 @@ namespace QSB.EyeOfTheUniverse.MaskSync public static List WentOnSolanumsWildRide = new(); - public void Awake() => QSBSceneManager.OnSceneLoaded += OnSceneLoaded; + private void Awake() => QSBSceneManager.OnSceneLoaded += OnSceneLoaded; private static void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool inUniverse) { diff --git a/QSB/RespawnSync/RespawnManager.cs b/QSB/RespawnSync/RespawnManager.cs index 6d6086cc..df802724 100644 --- a/QSB/RespawnSync/RespawnManager.cs +++ b/QSB/RespawnSync/RespawnManager.cs @@ -22,7 +22,7 @@ namespace QSB.RespawnSync private GameObject _owRecoveryPoint; private GameObject _qsbRecoveryPoint; - private void Start() + private void Awake() { Instance = this; QSBSceneManager.OnSceneLoaded += (_, newScene, inUniverse) diff --git a/QSB/SatelliteSync/SatelliteProjectorManager.cs b/QSB/SatelliteSync/SatelliteProjectorManager.cs index 8355a92d..b4ded5dd 100644 --- a/QSB/SatelliteSync/SatelliteProjectorManager.cs +++ b/QSB/SatelliteSync/SatelliteProjectorManager.cs @@ -30,7 +30,7 @@ namespace QSB.SatelliteSync private static RenderTexture _satelliteCameraSnapshot; - public void Start() + private void Awake() { Instance = this; QSBSceneManager.OnUniverseSceneLoaded += OnSceneLoaded; diff --git a/QSB/TimeSync/TimeSyncUI.cs b/QSB/TimeSync/TimeSyncUI.cs index 253b4f91..77b9fbba 100644 --- a/QSB/TimeSync/TimeSyncUI.cs +++ b/QSB/TimeSync/TimeSyncUI.cs @@ -9,7 +9,7 @@ namespace QSB.TimeSync { internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart { - public static TimeSyncUI Instance; + private static TimeSyncUI _instance; public static float TargetTime; @@ -20,9 +20,9 @@ namespace QSB.TimeSync private TimeSyncType _currentType; private Enum _currentReason; - public void Awake() + private void Awake() { - Instance = this; + _instance = this; enabled = false; QSBSceneManager.OnUniverseSceneLoaded += OnUniverseSceneLoad; @@ -47,10 +47,10 @@ namespace QSB.TimeSync } public static void Start(TimeSyncType type, Enum reason) => - Delay.RunWhen(() => Instance._isSetUp, () => Instance.StartTimeSync(type, reason)); + Delay.RunWhen(() => _instance._isSetUp, () => _instance.StartTimeSync(type, reason)); public static void Stop() => - Delay.RunWhen(() => Instance._isSetUp, () => Instance.EndTimeSync()); + Delay.RunWhen(() => _instance._isSetUp, () => _instance.EndTimeSync()); private void StartTimeSync(TimeSyncType type, Enum reason) { diff --git a/QSB/Utility/DebugCameraSettings.cs b/QSB/Utility/DebugCameraSettings.cs index 4cf15062..63f6ba1d 100644 --- a/QSB/Utility/DebugCameraSettings.cs +++ b/QSB/Utility/DebugCameraSettings.cs @@ -26,10 +26,11 @@ namespace QSB.Utility private static Color _origColor; - private void Start() + private void Awake() { _origColor = Camera.main.backgroundColor; UpdateFromDebugSetting(); + Destroy(this); } private static void OnSceneLoaded(OWScene arg1, OWScene arg2, bool arg3)