First of all, I´m sorry if this is the wrong place of the forum to post this in, it felt best in my opinion…
On to the problem:
So I´ve made a character in blender and added some animations to it, when I import the modell to Unity I get the animations within the object and I can play them in the little “pre-view” screen but wen I add the character to the scene and make a script to start playing the animations when I´ve pressed a special button it gives me an error!
Script:
function Update(){
if(Input.GetButtonDown(“Jump”)){
animation.Play(“Jump”);
}
}
Error:
There is no ‘Animation’ attached to the “Character” game object, but a script is trying to access it.
You probably need to add a Animation to the game object “Character”. Or your script needs to check if the component is attached before using it.
This is what every tutorial on youtube does! Wy wont it work? Plz help me! D:
Just what the error says: Doesn’t seem like there is an animation component attached to the corresponding game object. So basically Unity does not know what kind of animations are connected to the current asset.
Add the animation component and the animations, that should help.
The animation state Jump1 could not be played because it couldn’t be found!
Please attach an animation clip with the name ‘Jump1’ or call this function only for existing animations.
Are you absolutely sure you have a) assigned the Animation component and b) assigned the correct animation clip to the animation component’s animation slots?
I should have, yes. If the tutorilas on youtube are correct so too say… I´ve added “Animations” component too my character and under the animations thing in the component I´ve added my 4 animations… Then I´ve added my script…
When you import a file in Unity now the default Animation Type is set to ‘generic’ which is for all mecanim related animation.
In your case it look like you want to use the legacy animation system.
Select all your file and in the inspector under the Rig tab make sure they are all set to Animation Type ‘legacy’.
This should also add the Animation component for you on your Game object.