Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by AbePoppy · Nov 29, 2013 at 04:46 PM · animatormechanimunknown-identifiervariable-definition

Invalid Layer Index on mecanim animator

Hi guys, we've been crushing the heads on a wall for 3 days for this problem. I have a prefab instantiated several times by a script in the game scene. The prefab is composed by 2 objects, one inside the other. The Main_object and the inside_one. The inside_one has got an animator. It works perfectly for a month. We introduce a Network system, and it continue to works fine. 3 days ago the animator system starts to go mad (and we follow). I know is not professional to say something like this but situation is very strange: the inside_one has got a Animator component witch its Contoller is called Card_animator_controller and has got two layers and 8 parameters. In a script linked to the Main_object we use:

 public Animator anim;
 anim = transform.FindChild("inside_one").GetComponent<Animator>();
 
 if (anim) //we put this just to be sure
     Debug.Log ("Animator Exists!");
     
 Debug.Log ("anim controller: " + anim.runtimeAnimatorController.name);
 Debug.Log ("anim num of layers: " + anim.layerCount);

 anim.SetInteger("NameOfTheParameters", 0);
 AnimatorStateInfo infoAboutAniamtor = anim.GetCurrentAnimatorStateInfo(0);
 

these debugs produce this output:

"Animator exists!"

"anim controller: Card_animator_controller."

"anim num of layers: 0" (what?)

Waring: Parameter 'NameOfTheParameters' does not exist. (what!?)

Error: Invalid Layer Index (WHAT!?)

this is a snapshot of the Card_animator_controller: alt text

Any help would be grat! Thanks

animator fail.png (270.4 kB)
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

4 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by AbePoppy · Nov 29, 2013 at 04:58 PM

Something of more interesting: we open a new project, then we open the previous project and everything start again to work properly... O.O

how... what... but above all: why!?

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
avatar image
0

Answer by DarJam · Dec 10, 2013 at 07:05 PM

Thanks for the suggestion AbePoppy. Exiting Unity and reloading the project worked for me.

Due to all the problems with Unity/Maverick, my machine froze for 3+ mins and so i powered down my iMac whilst Unity was in Play mode. I reckon this act probably caused the problem.

Anyway thanks

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
avatar image
0

Answer by RKSandswept · Feb 16, 2014 at 08:41 AM

We had a similar problem. Switching project over and back did not solve it.

Turns out the GameObject (third person player avatar) with an animator was disabled at start up and then enabled later when the game is running. It appears that having the third person player avatar (over the shoulder view only)disabled makes the animator not get loaded or generated correctly.

Also the problem only showed up in the both a final and a debug build, but not in the debugger.

To fix this we enabled the whole third person player avatar during the build and then disabled it after start up.

This is probably an effect of the build removing any assets that are not used in the game, and the disable third person player avatar appeared to be 'not used' yet is a child GameObject of our overall player GameObject.

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
avatar image
0

Answer by trololo · Oct 07, 2014 at 01:47 PM

AbePoppy, did you find a better way to handle that problem? (i got exactly the same one...).

Comment
Add comment · Show 1 · 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 AbePoppy · Mar 19, 2015 at 02:41 PM 0
Share

Sorry for the late answer. Yes, using the new version of Unity the problem magically disappear XD

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.

Follow this Question

Answers Answers and Comments

21 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

Related Questions

Can you change AnimationClip in controller via scripting? 0 Answers

How to disable/override a part of an animation created in Unity 2017.4 0 Answers

Trying to use Mechanim Root Motion for 2d. 0 Answers

I can preview the animation but in scene it doesn't work 0 Answers

"GravityWeight" curve in animator is not affecting the rigidbody's gravity? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges