Reputation: 3423
I have an animation created in Animator where a part of UI transitions from one side of the screen to another. How to add an option to immediately finish the animation and put animated object in its final place?
Because animations are created by 3rd party and I don't know the locations upfront, I can't just stop the animation and set position of the object to the final one.
Thanks
Upvotes: 0
Views: 1263
Reputation: 2157
What you can do is something like this :
yourGameObject.GetComponent<Animation>().GetClip("YOUR_CLIP_NAME").SampleAnimation(yourGameObject, GetComponent<Animation>()["YOUR_CLIP_NAME"].length);
But this will only work if you know your AnimationClip name ahead...
Hope this helps,
Upvotes: 2