- Home /
MissingComponentException: There is no 'Animation'
Hello there,
I am recieving a very strange error regarding a missing Component, the full error is as follows:
You probably need to add a Animation to the game object "bear". Or your script needs to check if the component is attached before using it. UnityEngine.Animation.get_Item (System.String name) (at C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/Editor/Animations.cs:545) BearControlls.Start () (at Assets/BearControlls.cs:12) Please note, this error does not stop the game from running, nor do I believe it to be correct. It is referring to this line of code: animator.animation["backpedal"].normalizedTime = 1; However, the line does as expected and causes no problems, aside from the insistent error.MissingComponentException: There is no 'Animation' attached to the "bear" game object, but a script is trying to access it.
Answer by Owen-Reynolds · May 20, 2013 at 03:02 PM
The new Mechanim animation uses an animator
component. The old (but good) animation uses an animation
component. The line you have is using the old style, in a confusing way. The usual way is just animation["backpedal"]
. Putting the extra animator
in front make it look like it's using the new Mechanim, but it isn't.
It's like writing animation.rigidbody.AddForce
. It looks like an animation command, but it really says "find the animation. OK, now forget that and find the rigidbody next to it." The same way, you could write light.renderer.transform
and it's just a confusing way to say transform.
The error says you don't have a component labelled "Animation". Errors (almost) never stop the game from running, so nothing new there. They do abort further lines in that script. If the line worked, it would reset the backpedal animation to the 1st frame (assuming it's looping. normTime=1 is the last frame, which is the same as the 1st.)
The desired effect is to play an animation backwards (using speed of -1). Which is working, albeit with the error message.
'backpedal' is an animation within the $$anonymous$$ecanim AnimationController, as opposed to an Animation Clip within the Object.
Is there a command within the Animator component that I could achieve this with? I couldn't find anything suitable.
I think that's the right idea -- find the $$anonymous$$echniman commands to explicitly play something. I've never used it.
In theory, you could also add an old Animation component, but I'm guessing the two systems would fight each other.
I think it may simply be quicker to create a separate animation within my modelling package for the backpedal, ins$$anonymous$$d of playing the forwards walk in reverse. There doesn't seem to be an intuitive way to reverse animations currently.
The old system was more numbers-friendly. Very flexible, but it didn't catch on.
The new system seems geared towards pure animators, who would never dream of not making an explicit back-up. In general, animations are only played "the way god intended" -- forwards at full speed.
hey, i am new to unity.i am trying to make car game and using Realistic Car Controller V3 .i am trying to animate RCC Camera more than normal (using RCC Scripts) in start of gameplay.tried to change values in RCC Camera Script but could not do so.and also tried to add offset in camera position in levelcomplete (onCollisionEnter function) but nothing works.can anyone help ?
Answer by Ben Blaut · May 20, 2013 at 03:01 PM
The error means there is a point some time while running where the "bear" object does not have an animation on it. If it ends up working, that means it gets an animation at some point. Before that point, your code is trying to access the animation before it's there so it shoots back the error. Try checking for the animation before you do anything to access it.
if (animator.animation["backpedal"]) {
// animation stuff
}
I'm guessing if you tested all: if(animator==null) print A; else if(animator.animation==null) print B; else ...
then you'd get B. animator.animation
doesn't exist. So of course it can't play anything.
Your answer

Follow this Question
Related Questions
2D Animation does not start 1 Answer
change the wrap mode of a 2d animation 0 Answers
Blending between frames in the same animation (fake stop motion) 2 Answers
run animation when should idle 1 Answer
Create animation from script 0 Answers