- Home /
Sharing one animation on multiple clones
Hi! I am creating a virtual world in Unity, representing a crowded festival. I have found that animations are bottlenecking my application, because I have thousands of people, so I am looking for ways to improve the performance of animations.
Since most of the crowd is doing the exact same, I figured it would significantly improve the performance if I was able to share one animation between all these figures. So basically we would like Unity to calculate the animation for one instance and then share that between all the instances, so that they all have the same animation. Looking around on the internet, I found little information about sharing one animation/animator instance between multiple gameobjects, so I hoped I could get a little hint here.
Is there anything like this possible in Unity? Can I make Unity calculate one animation and share it across multiple gameobjects?
Any help with this would be greatly appreciated. We are using Unity 2019.1.0f1 so we can make full use of the new Entity Component System, if that makes any difference.
thank you in advance!
You can use the same animation on multiple objects but you can't have a single animation/animator component animate multiple objects unless you animate all of them as children in one animation.
Thank you very much for your response. That's really unfortunate that we can't share animations like this. But what if I were to code an animation in a script? Would it be possible to share transformations between all the objects? Or perhaps it would already make a difference to change the transformation in one place and then copy it to all the objects?
You could script it and then move everything using an array for the parents, and using GetChild() to move the children all within a for loop.
Answer by imaginationrabbit · Apr 25, 2019 at 06:40 PM
You might want to look into animation instancing in that case Youtube video on Animation Instancing
That looks very promising! I'll have a good look at that with the $$anonymous$$m and come back when I have some results.!
Thank you very much for your suggestion! We have implemented this technique in our product and the results were beyond our expectations! We can now render an animated crowd of 18 000(!!) people with decent frames and we still have opportunities to improve on that.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
animator.GetCurrentAnimatorStateInfo(0).IsName not working 1 Answer
two animations interacting smoothly 0 Answers
Script to access a button animation 0 Answers