public static void WriteHistory(GameObject go) { using (StreamWriter sr = new StreamWriter("contextZart.txt", true)) { foreach (KeyValuePair <GameObject, List <State[]> > k in TransitionHistory) { foreach (State[] s in k.Value) { XMLManager.GetID(k.Key.name); foreach (State t in s) { //StateName to and ID -_- sigh... sr.Write(FiniteStateMachine.States.IndexOf(t).ToString() + " "); } sr.Write(Environment.NewLine); } } } Debug.Log("Can't you write to file any faster Claus?"); }