Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Animator has not been initialized Warning

Discussion in 'UGUI & TextMesh Pro' started by defaxer, Aug 24, 2014.

  1. defaxer

    defaxer

    Joined:
    Nov 15, 2010
    Posts:
    140
    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:
    Code (CSharp):
    1. protected override void OnDisable()
    2. {
    3. #if UNITY_EDITOR
    4.             if (Application.isPlaying)
    5. #endif
    6.                 base.OnDisable();
    7. }
    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.
     
  2. JAKJ

    JAKJ

    Joined:
    Aug 17, 2014
    Posts:
    185
    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.
     
  3. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    this is happening to me in RC1, any idea? I only use the default controls
     
  4. defaxer

    defaxer

    Joined:
    Nov 15, 2010
    Posts:
    140
    Moving Animator Component down (last after all other components) fixed the issue for me
     
    Anx and shkar-noori like this.
  5. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    I'll try that, I think i tried re-ordering the components and it worked on basis
     
  6. Anx

    Anx

    Joined:
    Jan 2, 2014
    Posts:
    6
    This removed the error for me as well, thanks!
     
  7. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    this problem is still bugging me, but I'm using Unity 5.0b21, is there any way i can get rid of this warning?
     
  8. jsip

    jsip

    Joined:
    Jan 25, 2015
    Posts:
    8
    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.
     
    Last edited: Feb 15, 2015
  9. martin cole

    martin cole

    Joined:
    Jul 13, 2015
    Posts:
    1
    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.
     
  10. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    617
    Worked for me too.