public static AnimationWindowEvent CreateAndEdit(GameObject root, AnimationClip clip, float time) { AnimationEvent animationEvent = new AnimationEvent(); animationEvent.time = time; AnimationEvent[] animationEvents = AnimationUtility.GetAnimationEvents(clip); int num = AnimationWindowEvent.InsertAnimationEvent(ref animationEvents, clip, animationEvent); AnimationWindowEvent animationWindowEvent = ScriptableObject.CreateInstance <AnimationWindowEvent>(); animationWindowEvent.hideFlags = HideFlags.HideInHierarchy; animationWindowEvent.name = "Animation Event"; animationWindowEvent.root = root; animationWindowEvent.clip = clip; animationWindowEvent.clipInfo = null; animationWindowEvent.eventIndex = num; return(animationWindowEvent); }