public static Wave GetWave(string id) { TextAsset file = (TextAsset)Resources.Load("Waves"); XmlDocument doc = new XmlDocument(); doc.LoadXml(file.text); try { XmlNodeList nodes = doc.GetElementsByTagName("wave"); XmlNodeList events = GetNode(id, nodes).ChildNodes; Wave wave = new Wave(); wave.SetID(int.Parse(id)); for (int i = 0; i < events.Count; i++) { WaveEvent wEvent = ProcessWaveEvent(events[i]); wave.AddEvent(wEvent); } return(wave); } catch { return(null); } }