private static void OnControllerChanged() { if (_OnControllerChanged == null) { const string TypeName = "UnityEditorInternal.AnimationWindowUtility"; const string MethodName = "ControllerChanged"; try { var type = typeof(UnityEditorInternal.InternalEditorUtility); type = type.Assembly.GetType(TypeName); var method = type.GetMethod(MethodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); _OnControllerChanged = (Action)Delegate.CreateDelegate(typeof(Action), method); } catch { AnimancerEditorUtilities.RegisterNonCriticalMissingMember(TypeName, MethodName); _OnControllerChanged = () => { }; } } _OnControllerChanged(); }