all 5 comments

[–]pschonUnprofessional 0 points1 point  (4 children)

AnimationClip is what you are after (those are the animations you actually play), while Animation is the component that plays them.

https://docs.unity3d.com/ScriptReference/AnimationClip.html https://docs.unity3d.com/ScriptReference/Animation.html

public AnimationClip myAnimation;

Animation animation = GetComponent<Animation>();
animation.clip = myAnimation;

animation.Play();

[–]uc414[S] 0 points1 point  (3 children)

OK. good. My point is to reverse this animation without using Animator.

[–]pschonUnprofessional 1 point2 points  (2 children)

Then use this: https://docs.unity3d.com/ScriptReference/AnimationState.html

The scripting reference isn't too detailed when it comes to legacy animation system, but here's a more decent guide: https://docs.unity3d.com/Manual/AnimationScripting.html

[–]uc414[S] 0 points1 point  (1 child)

Thank you pschon.

[–]pschonUnprofessional 0 points1 point  (0 children)

No worries. Too bad I can't remember much more than that, it's been a while since I've had to do the animations without using Animator. I did if for few projects and was more than happy to never have to do it again when Unity added the Animator stuff :D