If you don’t add an animation component to your object BEFORE you record the animation, it will automatically add the component but also will try to add an ANIMATOR component and likely has ‘root motion’ switched on which interferes.
If I remember rightly (unless they fixed this) you have to add an ANIMATION component to your object first, and THEN record your animation clip, and then assign the clip to the animation component manually, otherwise the new animation system sort of interferes with things. At least that’s how I understand it.
Did you notice that “publicvoid” is meant to have a space in it in your sourcecode above? Or was that just a copying error? Do you get any editor errors? Do a Debug.Log(‘works’); right before the play command to make sure the program is flowing into that code.
It’s actually have a space, i don’t get any editor errors, i used Animator and it’s work just fine but i would love to use Legacy Animation, this is so hard
I seem to remember something about going to the animation clip in the inspector, then at the top of the inspector window there’s some little dropdown with an option to ‘debug’, and then it will show you some data fields, and one of those I think is a checkbox to say that the animation is ‘legacy’. … try that and see that it is checked. And then see if it works better?