- Home /
Cant animate through script
Before the new unity i was able to animate in unity easy, and script it to play the animation.
now i have problems with the new unity, finally i succeed animating an reload animation, but now when i want to play it it says:
The animation state Reload could not be played because it couldn't be found!
Please attach an animation clip with the name 'Reload' or call this function only for existing animations.
i added an animation, dragged the reload to it, and its still saying that error.
info:
in the weapon object i have:
Animator:,
Controller: M4A3,
Avatar: None,
Apply root motion: checked,
Animate physics: not checked,
Culling mode: always animate,
Animation:
Animation: Reload,
Animations:,
Size: 1,
Element 0 : Reload,
Play automatically: not checked,
Animate physics: not checked,
Culling mode: always animate,
The line of code is:
animObj.animation.Play("Reload");
I would advise that you use a different system for animations. Use $$anonymous$$ecanim and use the code to manage your transitions.
See here: http://answers.unity3d.com/questions/551679/unity-thinks-my-animation-is-not-attached-but-it-i.html
But i dont understand what to do, also because this is an old game i made (with old version of unity) I got some other weapons that have the same animation system and it works.
What version of Unity is this made in?
if you ask for the version when all worked: end of 3, or start of version 4
if you ask for the version now: its the newest.
also tryed to animate with the new animator(with script) using the unity3d tutorial(just converted it to javascript) and the animation works but its animating at start and also keep animating.
var anim : Animator;
var reloadHash = Animator.StringToHash("Reload");
function Start(){
anim = animObj.GetComponent(Animator);
}
also i have another line but that line only calls when it automatically reloads:
anim.SetTrigger(reloadHash);
and yes, if you ask i tryed deleting this line, still keeps animating.
And also i used animObj because i call this script from another object.
Edit: after some tests, i deleted all the animator related codes, and its still animating so i think its something much more easier-related to unity
help?????????????? i noticed its doesn't even related to the code, when i open the game it start looping.
Your answer
Follow this Question
Related Questions
Animation interference problem 1 Answer
Blender Animation in Unity Problem 0 Answers
FBX file animation problem 0 Answers
How can I get a blender FBX file's animations working in Unity? 0 Answers
How to export MMD model to Unity? 0 Answers