If I set Animation.animateOnlyIfVisible to false on a game object before any animation has been played on it, no animations will play on that game object. If I, on the other hand, first start an animation on the game object, and then turn off animateOnlyIfVisible in the next frame, everything works as expected.
Some pseudocode to clarify (where gameObject is a gameobject which has just been created and no animations has been started on it yet):
In this case the animation won’t play:
gameObject.animation.animateOnlyIfVisible = false;
gameObject.animation.CrossFade(“Idle”, 0.3f);
In this case the animation won’t play either:
gameObject.animation.CrossFade(“Idle”, 0.3f);
gameObject.animation.animateOnlyIfVisible = false;
In this case the animation will play:
Executed in frame X:
gameObject.animation.CrossFade(“Idle”, 0.3f);
Executed in frame X+1:
gameObject.animation.animateOnlyIfVisible = false;
Has anyone else experienced this? Is it a known bug? If not I could probably set up a scene reproducing it and submit a bug report.
I am using Unity Pro 2.6.1f3. The models are .fbx -files created in Maya.