IAddComponentOnStart: some of these can be destroyed right after running

This commit is contained in:
JohnCorby 2022-02-05 03:28:37 -08:00
parent f301af02f3
commit f8f37aa011
5 changed files with 10 additions and 9 deletions

View File

@ -16,7 +16,7 @@ namespace QSB.EyeOfTheUniverse.MaskSync
public static List<PlayerInfo> WentOnSolanumsWildRide = new();
public void Awake() => QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
private void Awake() => QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
private static void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool inUniverse)
{

View File

@ -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)

View File

@ -30,7 +30,7 @@ namespace QSB.SatelliteSync
private static RenderTexture _satelliteCameraSnapshot;
public void Start()
private void Awake()
{
Instance = this;
QSBSceneManager.OnUniverseSceneLoaded += OnSceneLoaded;

View File

@ -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)
{

View File

@ -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)