private void Init() { if (inited == false) { inited = true; if (splitInterface == null) { splitInterface = FindObjectOfType <SplitInterface>(); } if (splitInterface == null) { // Create split interface from Resource folder splitInterface = Instantiate(Resources.Load <SplitInterface>("SplitInterface")); splitInterface.gameObject.name = "SplitInterface"; splitInterface.transform.SetAsLastSibling(); DontDestroyOnLoad(splitInterface.gameObject); } // Create contaner for coroutines if (coroutineContainer == null) { coroutineContainer = FindObjectOfType <CoroutineContainer>(); if (coroutineContainer == null) { coroutineContainer = new GameObject().AddComponent <CoroutineContainer>(); coroutineContainer.name = "CoroutineContainer"; DontDestroyOnLoad(coroutineContainer.gameObject); } } Debug.Assert(splitInterface, "Wrong initial settings"); } }
private static SplitInterface splitInterface; // Interface for items split operations /// <summary> /// Awake this instance. /// </summary> void Awake() { if (splitInterface == null) { splitInterface = FindObjectOfType <SplitInterface>(); } if (splitInterface == null) { splitInterface = Instantiate(Resources.Load <SplitInterface>("SplitInterface")); splitInterface.gameObject.name = "SplitInterface"; splitInterface.transform.SetAsLastSibling(); } Debug.Assert(splitInterface, "Wrong initial settings"); }