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 BayOfXyz · Jun 01, 2014 at 09:10 AM · prefabanimatorsprite renderer

2d sprite animator - Invalid Layer Index

I've made 2d game using 2d sprite renderer, animator.

I've been set my animator as following image

alt text

Then save as prefab to instantiate later by code like

GameObject character = (GameObject)Instantiate(prefabArray[i]);

Then when I want this character to play any animation I use code like

myAnimator.Play("idle");

Everything works well when I test on editor, problem occurs when I build to iOS/Android.

Its said "Invalid Layer Index" and my character can't play any animation, it's occur to last character in my prefab array and it's not always occurred it's occur on some build (so I've to rebuild it again to fix this), I think it's might be Unity's bug (because it's occur sometime) so there are any solution to prevent this?

screenshot 2014-06-01 15.13.07.png (23.0 kB)
Comment
Add comment · Show 1
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 Sord · Jun 11, 2014 at 01:30 PM 0
Share

Same kind of problem. I instantiate gameobject and at Start() I try to play manually some animation. Occured maybe after 4.5 patch. Works well on editor (have got error in editor only once) but do that in phone (WP8) all the time.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by psyydack · Jun 11, 2014 at 02:20 PM

It's an Unity Bug : http://forum.unity3d.com/threads/editor-sporadically-forgets-about-a-mecanim-state-machine.203406/

Restarting the editor and rebuilding to devices fixes the issue, only to have it come back once in a while.

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 liortal · Feb 01, 2015 at 09:43 AM 0
Share

Is there a case number for this ? This screwed us now (released a bad build due to this)

avatar image psyydack · Feb 01, 2015 at 06:50 PM 0
Share

Case 573418

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

23 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

Related Questions

Setting animator parameter on a single instance of a prefab sets the parameter for all instances 3 Answers

Runtime instantiated prefab doesn't animate 3 Answers

All calls to Resources.Load stopped working on Amazon devices (Unity 5.6.3p3) 1 Answer

Controlling Animator through Script. I'm stuck please help! 0 Answers

spawns without controller-: Object reference not set to an instance of an object--but i swear it is! 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