public static bool InitializeGameobjectForAnimation(GameObject animatedObject) { Component component = AnimationWindowUtility.GetClosestAnimationPlayerComponentInParents(animatedObject.transform); bool result; if (component == null) { AnimationClip animationClip = AnimationWindowUtility.CreateNewClip(animatedObject.name); if (animationClip == null) { result = false; } else { component = AnimationWindowUtility.EnsureActiveAnimationPlayer(animatedObject); bool flag = AnimationWindowUtility.AddClipToAnimationPlayerComponent(component, animationClip); if (!flag) { UnityEngine.Object.DestroyImmediate(component); } result = flag; } } else { result = AnimationWindowUtility.EnsureAnimationPlayerHasClip(component); } return(result); }
public static bool InitializeGameobjectForAnimation(GameObject animatedObject) { Component componentInParents = AnimationWindowUtility.GetClosestAnimationPlayerComponentInParents(animatedObject.transform); if (!((UnityEngine.Object)componentInParents == (UnityEngine.Object)null)) { return(AnimationWindowUtility.EnsureAnimationPlayerHasClip(componentInParents)); } AnimationClip newClip = AnimationWindowUtility.CreateNewClip(animatedObject.name); if ((UnityEngine.Object)newClip == (UnityEngine.Object)null) { return(false); } Component animationPlayer = AnimationWindowUtility.EnsureActiveAnimationPlayer(animatedObject); bool animationPlayerComponent = AnimationWindowUtility.AddClipToAnimationPlayerComponent(animationPlayer, newClip); if (!animationPlayerComponent) { UnityEngine.Object.DestroyImmediate((UnityEngine.Object)animationPlayer); } return(animationPlayerComponent); }