Missing GetComponent<Animation>().Play

Hey Community,

some days ago I was playing around with Unity 5.5 and realised that some functions are missing. I tried to add an animation , nothing special. But Mono develop “told” me, that there is no “Play()” function for GetComponent() anymore. I checked the Unity 5.5 API and suprise, the function is still there. Do you know why my Unity version is making fun with me?

Regards

Kristian

I could be wrong but I believe you would do it this way now;

anim = GetComponent<Animation>();

anim.Play();
1 Like

Thanks WarmedXMints this helps me alot!

Animation is the old, obsolete animation component. Unless you explicitly set your models to import as “Legacy”, Animator is the class you want.