Animator has not been initialized Warning

I’m deriving my custom ui class from UnityEngine.UI.Selectable.
And if I use Animation as Transition method for this control this error appears (5 times actually):

Animator has not been initialized.
UnityEngine.UI.Selectable:OnDisable()

error is thrown from here:

protected override void OnDisable()
{
#if UNITY_EDITOR
            if (Application.isPlaying)
#endif
                base.OnDisable();
}

If I remove UNITY_EDITOR directive this error appears 10 times.
Is there some solution to this?
Control is working fine, except for this error in console.

I really wish I knew what was causing this error. Could it be the Animator components in my prefabs, or Animator components in disabled UI elements in my scene? It always seems to be accompanied by when I do “Build and Run”, and it ends up showing some components that are disabled as enabled and everything in the editor is messed up (but fine in game), and to fix it in the editor I have to disable/enable the canvas and then it draws everything correctly.

I can’t pin it down solidly enough to even put in a bug report. There is just something seriously funky going on.

this is happening to me in RC1, any idea? I only use the default controls

Moving Animator Component down (last after all other components) fixed the issue for me

2 Likes

I’ll try that, I think i tried re-ordering the components and it worked on basis

This removed the error for me as well, thanks!

this problem is still bugging me, but I’m using Unity 5.0b21, is there any way i can get rid of this warning?

IndexOutOfRangeException: Array index is out of range.
UnityEditor.Graphs.AnimatorControllerTool.OnGUI () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Animation/AnimatorControllerTool.cs:721)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

I haven’t found a solution yet.

Initialization problem came up for me too…With zombie model Z@Walk from unity store. The warning was in the inspector window on animator for me. I kept using humanoid as my option when i should have used Legacy instead then the problem was solved…hope this helps …my zombie animations are working perfect now.

Worked for me too.