• 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 bawenang · May 23, 2012 at 08:39 AM · animationanimationstate

animation.isPlaying == true but the animation[curAnimName].time is never incremented

Hi, I've got a state based routines that dependent on a particular animation to finish before moving to the next state. It goes like this:

 void Update() {
     switch(state) {
         case enumState.ANIMATE_1:
             player.animation.Play("someAnimation1");
             state = enumState.GAMELOGIC_1;
             break;
         case enumState.GAMELOGIC_1:
 Debug.Log("Animation time: " + player.animation["someAnimation"].time.ToString());
             if (player.animation.isPlaying) {
                 GameLogic1();
                 state = enumState.ANIMATE_2;
             }
             break;
         case enumState.ANIMATE_2:
             player.animation.Play("someAnimation2");
             state = enumState.GAMELOGIC_2;
             break;
         case enumState.GAMELOGIC_2:
 Debug.Log("Animation time: " + player.animation["someAnimation2"].time.ToString());
             if (player.animation.isPlaying) {
                 GameLogic2();
                 state = enumState.QUIT;
             }
             break;
         case enumState.QUIT:
             Application.Quit();
     }
 }

Since I needed to check whether or not we are still playing an animation before moving to the next state, animation states are crucial in this application. However my application behaves like this: The animation suddenly stopped (or more appropriately, crashed) and the mesh of the player is gone. However, the "player.animation.isPlaying" is always true and inside the Debug.Log, it said that the animation time is always the same every frame after the animation crashed. I tried incrementing the time manually in script but it didn't work and the mesh is still gone. The animations can be viewed in the Animation Viewer, well at least the first 3 secs. The animations themselves are around 6-7 secs each. The animations are all in the 'Once' wrap mode, so they should've ended. Even when it's not in Wrap mode, meshes suddenly disappearing and the timing of the animation stops is wrong. Any idea what happened here? I'm currently lost and don't really know what to do again.

Thanks in advance guys.

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

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Mecanim Animation Gets Stuck 0 Answers

AnimationState.AddMixingTransform 1 Answer

Can the animation editor create local rotational data? 3 Answers

Animation works, pathfinding works, but they don't work together. 1 Answer

How to call a fixedUpdate() in a clampforever animation?? 0 Answers


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