Im try create new project from scratch. But is also not working.
Im add project to zip see attachment.
When you run it, then object is moving by animation. but sprite is not changed, see
Please help me. Im working on this 5 hours and nothings happens.
That’s a lot of code to play one animation! Try a simpler approach:
GetComponent<Animation>().Play("left");
[edit]
Just saw your comment about sprite changing. You can’t change sprites with the legacy animation system; you need to use an Animator instead of an Animation component.
Ok. But i need generate animation on The fly. And i cant do it with Animator. What Im try, I cant add AnimationClip to Animator component.
I have lots of animations, And I not Need it all. So how I can do it?
And why is not working sprite changing with Animation? everything other is working, changing sprite color is also working
Legacy animation doesn’t support sprite parameter keyframes, nor does it support old legacy animation clips. Nothing you can do about that, as far as I know.
Sounds like your options are to use the new Animator (mecanim) system 100% and recreate your clips, or to code your own sprite swaps over time. Either way, you won’t be using the legacy animation system.