using UnityEngine; namespace FishNet.Utility { public class DDOLFinder : MonoBehaviour { #region Public. /// /// Singleton instance of this class. /// public static DDOLFinder 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 = "DDOLFinder"; DontDestroyOnLoad(gameObject); } } /// /// Returns the current DDOL or creates one if not yet created. /// public static DDOLFinder GetDDOL() { //Not yet made. if (Instance == null) { GameObject obj = new GameObject(); DDOLFinder ddol = obj.AddComponent(); return ddol; } //Already made. else { return Instance; } } } }