• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by LordCainen · May 30, 2020 at 08:01 PM · animator controlleranimationsanimationstate

Animation State of Controller not showing in Inspector when clicked

I recently updated my Unity version to 2019.3.15f1. I opened a project which was created in the 2017 version of unity. My problem is that after upgrading to the new version, when I click on a state in the animator controller the state sometimes does not show in the inspector. But that's not all. Some states do show in the inspector when clicked some do not. For example I had a script on a statemachine that handles multiple animations. The script also does not show when I click on the statemachine.

I don't know if I am missing something obvious, or if it actually is a problem created by switching the version.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

9 Replies

· Add your reply
  • Sort: 
avatar image
10

Answer by desertGhost_ · Jun 02, 2020 at 04:24 PM

So this is an issue they are aware of:

https://issuetracker.unity3d.com/issues/inspector-not-displaying-state-and-transition-properties-once-duplicated

The work around is to "Open the Animator file in a Text Editor and change the 'm_ObjectHideFlags' properties for the affected states from '3' to '1'"

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image EliseRealcast · Jul 09, 2020 at 10:31 AM 0
Share

That did the trick for me, thanks!

avatar image AL_W · Aug 16, 2020 at 06:11 PM 1
Share

This "hack" solved it! Thanks so much. We should all VOTE on that issue tracker and submit a bug report Via Unity editor.. so this can be fixed properly. =)

avatar image Anizmo · Dec 26, 2020 at 10:17 AM 0
Share

Where can I find the Animator file? I have been facing the same issue

avatar image EliseRealcast Anizmo · Dec 28, 2020 at 10:16 AM 0
Share

Right click on the AnimatorController asset in your Unity project (in the Project tab of your editor) and select “Show in explorer”. A file explorer window will open the folder containing the asset, look for the “.controller” extension :)

avatar image
4

Answer by punk · Jul 27, 2020 at 06:59 AM

Thanks @NapsTeam Lifesaver! I updated your script to deal with Sub Statemachines and BlendTree's also

 using UnityEditor;
 using UnityEngine;
 
 public class AnimUnhideTool : ScriptableObject
 {
     [MenuItem("Assets/Unhide Fix")]
     private static void unhide()
     {
         UnityEditor.Animations.AnimatorController ac = Selection.activeObject as UnityEditor.Animations.AnimatorController;
 
         foreach (UnityEditor.Animations.AnimatorControllerLayer layer in ac.layers)
         {
 
             foreach (UnityEditor.Animations.ChildAnimatorState curState in layer.stateMachine.states)
             {
                 if (curState.state.hideFlags != 0) curState.state.hideFlags = (HideFlags)1;
                 if (curState.state.motion != null)
                 {
                     if (curState.state.motion.hideFlags != 0) curState.state.motion.hideFlags = (HideFlags)1;
                 }
             }
 
             foreach (UnityEditor.Animations.ChildAnimatorStateMachine curStateMachine in layer.stateMachine.stateMachines)
             {
                 foreach (UnityEditor.Animations.ChildAnimatorState curState in curStateMachine.stateMachine.states)
                 {
                     if (curState.state.hideFlags != 0) curState.state.hideFlags = (HideFlags)1;
                     if (curState.state.motion != null)
                     {
                         if (curState.state.motion.hideFlags != 0) curState.state.motion.hideFlags = (HideFlags)1;
                     }
                 }
             }
         }
         EditorUtility.SetDirty(ac);
     }
 }
Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image NapsTeam · Jul 27, 2020 at 11:18 AM 0
Share

@punk thanks man ! Now it's more then perfect :) Looking forward to a fix, which is not yet done even on 2020.1b

avatar image thenut · Aug 02, 2020 at 09:06 PM 0
Share

Thanks @NapsTeam and @punk - I had hidden transitions too, so I modified the script to unhide those. Just added the following inside both foreach curState loops:

 foreach (UnityEditor.Animations.AnimatorStateTransition curTrans in curState.state.transitions)
 {
     if (curTrans.hideFlags != 0) {
         Debug.Log("...fixing transition");
         curTrans.hideFlags = (HideFlags)1;
     }
 }

avatar image SpectreV98 · Aug 21, 2020 at 12:58 PM 1
Share

where to make the change ?i see no script in animation

avatar image hardtobepsd · Aug 29, 2020 at 04:58 PM 0
Share

how to use it??

avatar image aeza90 · Oct 07, 2020 at 07:07 AM 1
Share

why the hell no body talks about how to use it, as if everyone here is some sort of Unity expert or something, guys there are newbies everywhere, pls help each other

this thing in the first line of the solution code that says: [$$anonymous$$enuItem("Tools/Animator States Unhide Fix")] is some sort of a new menu option on your Unity Editor the first part before slash is the menu in editor you have to look at, here is Tools, other solutions have Assets instead, the second part is the newly created option in that menu so you need to create an empty script in your scrips folder or where ever in your assets folder, then you need to copy paste the solution code in it, and then the option will be added to your EDITOR, after that you need to go to the Project tab in editor and go to your model and find the animator file that ends with .controller extension, click on it and select it, then go to the newly created option and choose it, then the script runs and activates the solution

avatar image
3

Answer by NechyporukEvgen · Aug 06, 2020 at 10:45 AM

Multiple fixer:

 using UnityEditor;
 using UnityEngine;
 
 public class AnimUnhideTool : ScriptableObject
 {
     [MenuItem("Tools/Animator States Unhide Fix")]
     private static void Fix()
     {
         if (Selection.objects.Length < 1) throw new UnityException("Select animator controller(s) before try fix it!");
         int scnt = 0;
         foreach (Object o in Selection.objects)
         {
             UnityEditor.Animations.AnimatorController ac = o as UnityEditor.Animations.AnimatorController;
             if (ac == null) continue;
             foreach (UnityEditor.Animations.AnimatorControllerLayer layer in ac.layers)
             {
                 foreach (UnityEditor.Animations.ChildAnimatorState curState in layer.stateMachine.states)
                 {
                     if (curState.state.hideFlags != 0)
                     {
                         curState.state.hideFlags = (HideFlags)1;
                         scnt++;
                     }
                     if (curState.state.motion != null)
                     {
                         if (curState.state.motion.hideFlags != 0) curState.state.motion.hideFlags = (HideFlags)1;
                     }
                 }
                 foreach (UnityEditor.Animations.ChildAnimatorStateMachine curStateMachine in layer.stateMachine.stateMachines)
                 {
                     foreach (UnityEditor.Animations.ChildAnimatorState curState in curStateMachine.stateMachine.states)
                     {
                         if (curState.state.hideFlags != 0)
                         {
                             curState.state.hideFlags = (HideFlags)1;
                             scnt++;
                         }
                         if (curState.state.motion != null)
                         {
                             if (curState.state.motion.hideFlags != 0) curState.state.motion.hideFlags = (HideFlags)1;
                         }
                     }
                 }
             }
             EditorUtility.SetDirty(ac);
         }
         Debug.Log("Fixing " + scnt + " states done!");
     }
 }
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hardtobepsd · Aug 29, 2020 at 04:59 PM 0
Share

how to use it?

avatar image mrCrush · Oct 06, 2020 at 09:49 PM 0
Share

Thank you very much, man!

avatar image
2

Answer by desertGhost_ · May 31, 2020 at 02:30 AM

I also am having this issue in my project after upgrading to 2019.3.15f1. I think this could be a bug. I made a copy of my project and tried opening it in 2020.1.0b10 with the same result. I just hope that the animator controllers weren't corrupted by 2019.3.15f1. Has anyone filed a bug report?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image LordCainen · Jun 01, 2020 at 12:30 PM 0
Share

From what I have seen the individual animation states are probably corrupted. If I copy them inside the same controller, the copied version is also not visible. If I however import the same animation again from the model into the controller, it shows up normally. I'll file a bug report for this but the controllers have to probably be recreated in the end which is a little bit annoying. It's interesting though because I have played the scene with all animator controllers again and again and it seems that all data of the controllers still works because everything works as intended. Only once or twice did the scripts and animations not work when played. So it might just have to do with the editor itself. $$anonymous$$aybe something was changed from the old unity versions that can not be understood by the new versions of the editor.

avatar image desertGhost_ LordCainen · Jun 01, 2020 at 04:56 PM 0
Share

That was my thinking so I started creating a new animator controller (there were somethings that I wanted to reorganize in mine anyway). The first layer I created works fine, but interestingly the second layer I created began experiencing the issue after a while. I did recreate a simple repro project and submitted a bug report, but I have not heard back on whether they have been able to reproduce the bug yet.

avatar image
1

Answer by reigota · Sep 02, 2020 at 08:03 PM

A bit more complete and recursive solution, based on previous answers:

 using UnityEditor;
 using UnityEngine;
 
 public class AnimUnhideTool
 {
     [MenuItem("Tools/Animator States Unhide Fix")]
     private static void Fix()
     {
         if (Selection.objects.Length < 1)
             throw new UnityException("Select animator controller(s) before try fix it!");
 
         int scnt = 0;
 
         foreach (Object o in Selection.objects)
         {
             UnityEditor.Animations.AnimatorController ac = o as UnityEditor.Animations.AnimatorController;
             if (ac == null)
                 continue;
 
             foreach (UnityEditor.Animations.AnimatorControllerLayer layer in ac.layers)
             {
 
                 foreach (UnityEditor.Animations.ChildAnimatorState curState in layer.stateMachine.states)
                 {
                     scnt = FixState(scnt, curState);
                 }
 
                 scnt = FixStateMachines(scnt, layer.stateMachine.stateMachines);
 
             }
             EditorUtility.SetDirty(ac);
         }
         Debug.Log("Fixing " + scnt + " states done!");
     }
 
     private static int FixStateMachines(int scnt, UnityEditor.Animations.ChildAnimatorStateMachine[] stateMachines)
     {
         foreach (UnityEditor.Animations.ChildAnimatorStateMachine curStateMachine in stateMachines)
         {
             if (curStateMachine.stateMachine.hideFlags != (HideFlags)1)
             {
                 curStateMachine.stateMachine.hideFlags = (HideFlags)1;
             }
 
             if (curStateMachine.stateMachine.stateMachines != null)
             {
                 scnt = FixStateMachines(scnt, curStateMachine.stateMachine.stateMachines);
             }
 
             if (curStateMachine.stateMachine.entryTransitions != null)
             {
                 foreach (UnityEditor.Animations.AnimatorTransition curTrans in curStateMachine.stateMachine.entryTransitions)
                 {
                     if (curTrans.hideFlags != (HideFlags)1)
                     {
                         curTrans.hideFlags = (HideFlags)1;
                     }
                 }
             }
 
             foreach (UnityEditor.Animations.ChildAnimatorState curState in curStateMachine.stateMachine.states)
             {
                 scnt = FixState(scnt, curState);
             }
         }
 
         return scnt;
     }
 
     private static int FixState(int scnt, UnityEditor.Animations.ChildAnimatorState curState)
     {
         if (curState.state.hideFlags != (HideFlags)1)
         {
             curState.state.hideFlags = (HideFlags)1;
             scnt++;
         }
         if (curState.state.motion != null)
         {
             if (curState.state.motion.hideFlags != (HideFlags)1)
                 curState.state.motion.hideFlags = (HideFlags)1;
         }
         if (curState.state.transitions != null)
         {
             foreach (UnityEditor.Animations.AnimatorStateTransition curTrans in curState.state.transitions)
             {
                 if (curTrans.hideFlags != (HideFlags)1)
                 {
                     curTrans.hideFlags = (HideFlags)1;
                 }
             }
         }
         if (curState.state.behaviours != null)
         {
             foreach (StateMachineBehaviour behaviour in curState.state.behaviours)
             {
                 if (behaviour.hideFlags != (HideFlags)1)
                     behaviour.hideFlags = (HideFlags)1;
             }
         }
         return scnt;
     }
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

226 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I rotate specific joints/bones using a script? 1 Answer

Animations 2D isometric game - switching angles 0 Answers

how to play two animations of one gameobject without reducing the weight or any speed 0 Answers

Confused about animations 1 Answer

How can I switch animations while program is running on a game object? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges