using UnityEngine; namespace FirstGearGames.Utilities.Objects { public class DDOL : MonoBehaviour { #region Public. /// /// Singleton instance of this class. /// public static DDOL Instance { get; private set; } #endregion private void Awake() { FirstInitialize(); } /// /// Initializes this script for use. Should only be completed once. /// private void FirstInitialize() { if (Instance != null && Instance != this) { Debug.LogError("Multiple DDOL scripts found. There should be only one."); return; } else { Instance = this; gameObject.name = "FirstGearGames DDOL"; DontDestroyOnLoad(gameObject); } } /// /// Returns the current DDOL or creates one if not yet created. /// public static DDOL ReturnDDOL() { //Not yet made. if (Instance == null) { GameObject obj = new GameObject(); DDOL ddol = obj.AddComponent(); return ddol; } //Already made. else { return Instance; } } } }