diff --git a/Assets/Scripts/Behaviours/UIManager.cs b/Assets/Scripts/Behaviours/UIManager.cs index cda10818..3d4305ee 100644 --- a/Assets/Scripts/Behaviours/UIManager.cs +++ b/Assets/Scripts/Behaviours/UIManager.cs @@ -5,10 +5,10 @@ using SanAndreasUnity.Utilities; namespace SanAndreasUnity.Behaviours { - public class UIManager : MonoBehaviour + public class UIManager : StartupSingleton { - public static UIManager Instance { get; private set; } + public static UIManager Instance => Singleton; bool m_useTouchInput = false; public bool UseTouchInput @@ -45,10 +45,8 @@ namespace SanAndreasUnity.Behaviours - void Awake() + protected override void OnSingletonAwake() { - - Instance = this; // enable touch input by default on mobile platforms if (Application.isMobilePlatform) diff --git a/Assets/Scripts/GameModes/GameModeManager.cs b/Assets/Scripts/GameModes/GameModeManager.cs index 2d447d87..54a1585f 100644 --- a/Assets/Scripts/GameModes/GameModeManager.cs +++ b/Assets/Scripts/GameModes/GameModeManager.cs @@ -1,13 +1,14 @@ using System; using System.Collections.Generic; using SanAndreasUnity.Net; +using SanAndreasUnity.Utilities; using UnityEngine; namespace SanAndreasUnity.GameModes { - public class GameModeManager : MonoBehaviour + public class GameModeManager : StartupSingleton { - public static GameModeManager Instance { get; private set; } + public static GameModeManager Instance => Singleton; public class GameModeInfo { @@ -31,12 +32,7 @@ namespace SanAndreasUnity.GameModes private GameModeInfo m_selectedGameMode; - void Awake() - { - Instance = this; - } - - private void Start() + protected override void OnSingletonStart() { NetManager.Instance.onServerStatusChanged += OnServerStatusChanged; }