I’m new in Unity and doing some self-learning.
When I was having fun with the animations using a single cube. I found that both the animation and animator components can animate the transform properties. But when it comes to material, it seems that only the animator can accomplish the material change such as the mateiral._color.a. Changing material values in animation clip just don’t work.
Well, I may have a problem presenting my issue. I uploaded a simple project displaying my question. In the project, scene test1 uses animator while test2 using animaiton.
Best regards and Happy New Year.
The animation component is the legacy animation system which was not updated since 4.0, it doesn’t support new feature like Sprite animation or material properties animation. In those case you have to use the new Animator Component.
Well , I need to know how to create Sprite AnimationClips during runtime which can be used by the animator.
In the “Legacy” animation ,there is a way to create and add AnimationClip dynamic for the Animation component. However,Mecanim only could Override the Slot already in the animator controller, what make matter worse, i can not get the all animation clip informations, only can GetCurrentStateInfo,you know what i mean ,it’s inconvenience. i’d like to bind some animation events for the animations in the animator controller.Now the only way to do this is produce a new AnimatorOverrideController and override old one . oh my god!!!huge circle isn’t it ?
and more ,i need to create sprite Animation during runtime ,what should i do ? where is the property name like"localPosition.x" in the AnimationCurve?
Those questions make me annoy.
You need to create Animation and apply this animation to your object, what You need to do is to disable the animator for that object and enable that animation at run time using script, like obj.enable=true;
After learn more about Sprite animation i can understand why there is no way to create Sprite animation curve at runtime now. Thank you for your reply. before 5.0 i still can access the animationclips by RuntimeAnimatorController, however it will be more steps to do the same thing;)
Hi there , the RuntimeAnimatorController looks like a jar which can put the same animation as the AnimatorController you already have .so things turned easy.
animator = GetComponent();
you can get animator.runtimeAnimatorController THEN create an AnimatorOverrideController to recieve the informations …from the override one you can get the source AnimationClips. the more detail should found in the Unity Script documents