- Home /
Trying to play animation made inside unity, with script, but it can't be found.
Ok I give up. I don't usually use animations made in Unity, but when I do, they don't work. So far I've used animations made in Blender and that works fine. But now I made a simple 360 rotation of an object in Unity and I wanna play it but it won't work. The animation takes in only the rotation curve of the object.
I did the following and it says the animation couldn't be played cause it couldn't be found.
Made the animation on the object.
Added the animations into the inspector in Animations component of the object.
tried to play it with
animation.Play("BarrelRollRight");
but it won't work.
I get this error:
"The animation state BarrelRollRight could not be played because it couldn't be found! Please attach an animation clip with the name 'BarrelRollRight' or call this function only for existing animations. UnityEngine.Animation:Play(String) PlayerController:FixedUpdate() (at Assets/Scripts/Level/PlayerController.js:119)"
Line 119 is the line I posted above ^
What am I doing wrong? Does the animation need to be in some specific location? In a variable? The name is spelled correctly as you can see. Or maybe I'm blind. xD
Answer by ChrisSch · Mar 19, 2014 at 08:36 PM
Re-importing didn't work but I solved it by just dragging the fbx object into scene and basically making the prefab again. It didn't work before because the prefab was made before the fbx model had an armature, so it had to be dropped in scene again.
Posting in case anyone else has a dummy moment like this too. :P
Your answer
![](https://koobas.hobune.stream/wayback/20220613140001im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Make ball flip around cube... 0 Answers
wrong rotation in animation per script 0 Answers
wrong rotation to animation per 0 Answers
fbx animation beats script animation? 2 Answers
animation & position problem 0 Answers