There's more...

In the FlockDecoration.cs script, we also try to desynchronize the animations of our birds. We do it in the Start() function for every bird by setting the speed variable in its Animator to a random number:

        for (int i = 0; i < birds.Length; i++) 
            Animator anim = birds[i].GetComponent<Animator>(); 
            anim.speed = Random.Range(0.8f, 1.3f); 

That makes the birds play their animations with randomized playback speed. We could randomize it further by creating multiple versions of FlyInCircles and Idle animations. Then we would have to randomly choose currently played animation (see the next recipe for details).

In the Import settings of our FBX file, in the Rig tab, we also checked the Optimize Game Objects option. This makes our ...

Get Unity 5.x Animation Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.