• 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 Khairon · Dec 05, 2014 at 01:54 PM · animationandroidmecanim

Animation not always plays on non humanoid character for Android build

This bug is very hard to reproduce I've tried, but I can't figure it out. In general: We are working on multiplatform game (artistic implementation of classic Don't get angry/Ludo/Pachsi game). We have four types of figures/tokens (non humanoid player characters) and each figure has Idle animation state and jumping animation state (connected via bidirectional transitions in animation controller) and we are using Mecanim. We have four types of figures (Rabbits, Cats, Mices and Frogs)

The bug that we are experiencing for Android build is that not all the time animation for Mice figures starts to play. I've tried to attach adb from platform-tools in android-sdk and I don't see any exceptions or errors and thus I can't tell for sure if all resources were loaded correctly or what was the casue. Is this a bug, or we are possibly doin'g something wrong? Is there any way how to validate if all resources were successfuly loaded and if not try to reload them again?

Also all of the figures are stored as prefabs and instantiated when the scen is loaded in Awake method.

Can somebody give us any suggestions how to track down what is going on. The main problem is that this kind of bug doesn't happen always and I'm not sure if rebuilding the project and creating new apk will work in future when working apk will be deployed to Google Play.

Comment
Add comment · Show 5
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 pako · Dec 05, 2014 at 04:25 PM 0
Share

So, you are saying that the $$anonymous$$ice animation works 100% for you when you are in Play mode in the editor, but fails some times when running on Android device? ...and that you don't have any Android specific code in your project?

avatar image Khairon · Dec 05, 2014 at 06:15 PM 0
Share

Yes I don't have any Android specific code in my code base. When I'm thinking about the bug deeply I have an idea if this bug can be caused by following reason: I have GameObject (which is also prefab) which encapsulates all four figures (With this I'm able to just drop prefab into the scene and all figures have their positions) Then I have Game$$anonymous$$anagerScript which in Awake () instantiates all GameObjects that are prefabs containing the figures. $$anonymous$$y bet would be that Unity somehow can't always properly initialize Animation Controllers durign instatiation of more complex prefab. I'm going change existing GameObject (holding figures) to hold just one figure prefab and during instantion of this parent GameObject I will manualy instantitate figure after figure and than I will try to observe if this situation will happen again or not.

avatar image Khairon · Dec 05, 2014 at 06:52 PM 0
Share

Also this strange behavior started after upgrade to Unity 4.6.0

avatar image Khairon · Dec 05, 2014 at 07:40 PM 0
Share

Yes I reported this situation to Unity, but so far no response frome them :(

avatar image BlackPanda · Dec 13, 2014 at 10:23 AM 0
Share

I'm having the same issue, but in 2D sprite animation. Anyone found solution to this??

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Kjell-Andersson · Feb 14, 2015 at 01:16 AM

I'm also experiencing the same problem as you.

Sometimes when building for Android some characters that are using Mechanim Animator does not start their playback of their animations. It's very annoying since every build I need to potentially rebuild just because the animations won't start. There must be some bad state set in the resulting apk while building because if I manage to get a good build there will not be any problems with running that build.

I think I've found a work-around, but I can't say if it is 100% fool proof or not. Before I do an Android build I press play in the editor and check that the animations are working. If they work in the editor, I think I've noticed that they will work on the Phone as well. The thing is that the animation problem may appear in the editor as well if Android is selected as the build target. I think this is also just a problem if Unity has been recently restarted before doing a build, but I'm not 100% on that one.

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 Khairon · Feb 14, 2015 at 09:46 AM

I think I also found the solution, but I'm unable to confirm since meanwhile I'll updated unity (so it might be fixed also). What I did was, that I deleted all the animation controllers and recreated them from scratch. I had to do the overhaul since my 3d artist delivered me new set of Idle animations. What I found out is, that sometimes when you are changing value types for parameteres in Animator editor window the Mecanim is unable to recognize the change during state transitions. I think there is a bug somewhere in here and I submitted bug report to Unity but no response since then. I debugged this issue like few hours just to find out that my code is ok and problem is there. I found out that it's not enough to delete the parametere so I deleted whole controller and creted new one and everything worked fine. So I deleted rest of my controllers, create them from scratch and everything looks thats working.

Also your suggestion isn't bad one, since I've also noticed that from time to time when I hit play, some of my figures were strangely positioned, or animations didn't play. I've tried to put workarounds into the code and Debug messages in case that animator component is null (I've retrieved it via GetComponentInChildren) but didn't hit any null pointer exceptions, or Debug.Log messages.

This bug also occoured to me on iOS when I've created animations for UI where I wanted to have slider like menu to notify which user is on the turn. I was doing deployment for iOS when I've noticed that my slider bars won't move (This happened on Unity 4.6.1) Than I went to look what happened to my animations in Unity when the editor crashed into oblivion :D

After restart and rebuild/redeploy everything worked fine.

This bug is really irritating one, since after each build you have to by yourself verify if each animation is played? I can't imagine if something like this happens on larger scale projects. I feel sorry for developers...

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 bigmonkgames · Mar 27, 2016 at 01:21 AM 0
Share

Same here. I'm new to unity and it has been driving me up a wall. I have a small game i'm working on to get used to Unity and so far everytime I build to my iPhone my player gets stuck in the idle animation. It happens at times on the desktops as well but fixes when I restart unity. Seems like a bug to me.

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Mecanim animation issue 1 Answer

Can the mecanim animators Controller var be set in code? 1 Answer

Using Override Animation Controllers (NOT WORKING) 0 Answers

Random float parameter for idle animations 1 Answer

How can I determine when a MecAnim animation is done? 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