public static IEnumerable <T> LoadXmlDataInResourcesFolder <T>(string folderPath) where T : new() { XmlInheritance.Clear(); List <LoadableXmlAsset> assets = new List <LoadableXmlAsset>(); object[] textObjects = Resources.LoadAll <TextAsset>(folderPath); object[] array = textObjects; for (int j = 0; j < array.Length; j++) { TextAsset textAsset = (TextAsset)array[j]; LoadableXmlAsset loadableXmlAsset = new LoadableXmlAsset(textAsset.name, string.Empty, textAsset.text); XmlInheritance.TryRegisterAllFrom(loadableXmlAsset, null); assets.Add(loadableXmlAsset); } XmlInheritance.Resolve(); for (int i = 0; i < assets.Count; i++) { using (IEnumerator <T> enumerator = DirectXmlLoader.AllGameItemsFromAsset <T>(assets[i]).GetEnumerator()) { if (enumerator.MoveNext()) { T item = enumerator.Current; yield return(item); /*Error: Unable to find new state assignment for yield return*/; } } } XmlInheritance.Clear(); yield break; IL_0195: /*Error near IL_0196: Unexpected return in MoveNext()*/; }
public static IEnumerable <T> LoadXmlDataInResourcesFolder <T>(string folderPath) where T : new() { XmlInheritance.Clear(); List <LoadableXmlAsset> assets = new List <LoadableXmlAsset>(); object[] textObjects = Resources.LoadAll <TextAsset>(folderPath); foreach (TextAsset textAsset in textObjects) { LoadableXmlAsset loadableXmlAsset = new LoadableXmlAsset(textAsset.name, "", textAsset.text); XmlInheritance.TryRegisterAllFrom(loadableXmlAsset, null); assets.Add(loadableXmlAsset); } XmlInheritance.Resolve(); for (int i = 0; i < assets.Count; i++) { foreach (T item in DirectXmlLoader.AllGameItemsFromAsset <T>(assets[i])) { yield return(item); } } XmlInheritance.Clear(); yield break; }