private KeyValuePair <StateTransition, State> GetTransitionPairByKey <T>() where T : StateTransition { for (int i = 0; i < transitionDict.Keys.Count; i++) { StateTransition stateTransition = transitionDict.Keys.ElementAt(i); Type type = stateTransition.GetType(); if (type == typeof(T)) { return(transitionDict.ElementAt(i)); } } Debug.LogError("Unable to find StateTransition of type: " + typeof(T).Name); return(new KeyValuePair <StateTransition, State>()); }