public virtual void Awake() { collection = GetComponent <ItemCollectionBase>(); if (collection.useReferences) { StartCoroutine(WaitAndLoad()); } else { collection.LoadEasySave2(fileName, additionalFields); } }
/// <summary> /// Method used for references, because a reference can only be created when other collections are loaded. /// </summary> /// <returns></returns> private IEnumerator WaitAndLoad() { yield return(null); // Wait a frame to make sure non-reference collections are done. collection.LoadEasySave2(fileName, additionalFields); }