Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 snakegclct · Aug 23, 2016 at 07:39 AM · animationanimatorexecution orderanimation events

Issue about transforming animation in animation event and then in update function continuously

Hi, all, I got issues about transforming animations, I may have fixed it, but I still have some questions about it. The detailed case is here:

  1. For my monster character, if it doesn't find player within time limit, it will turn round. This will call animator to play "flip" animation(Using animator.Play(name) for my 2D game). And the status parameter will be set to "FLIP"

  2. In the last animation frame of the "flip", animation event will set the monster status to "IDLE" and play "idle" animation.(And "flip" animation is NOT a loop animation)

  3. And then in my logic, I make one mistake. In the update function in the next frame, (I should have known that the animator event and animator update happens after update function.) because the status has been set to "IDLE", the monster continues to check the player, and this time, it find the player.

  4. So, as the monster has turned round, it needs to turn round again to face the player, it calls the animator to play "flip" and set status to "FLIP".

That cause the problem. Because the state of the animator is still "flip", it will not be updated after the update function of the next frame. So the final animator state is "idle", and it has no animator event to set the related info of the monster to "idle" status. So the monster stuck :P.

So if I need to fix it directly, I can just use the play(name, layer, time) function and set time to 0, and this works. And there are lots of ways to fix such issue. But I have three question about it:

  1. I've read some information about the Execution Order of Event Functions(https://docs.unity3d.com/Manual/ExecutionOrder.html) and we can know that the animation internal update happens after the update function. So I want to confirm that, is it whenever I call the Play function of the animator, it will always update the state of the animation in the animation internal update happens after the update function in this frame or next frame ? And is it true that the animation event happens after the animation internal update has been done?

  2. The final state of the animator is "idle", but not stuck in "flip". Obviously, I set animator to play "idle" first in animation event and then in the function update of the next frame I set animator to play "flip" and this may be invalid. So the animator only response the "valid" call or only response the first call or something else?

  3. When I used the mono IDE to debug my code to reproduce this issue, after the break point in the animation event hit, I tried to debug it frame by frame, but the console displayed a warning about CallBack (I'm sorry that I'm not using my own PC and cannot get the detailed warning message now, I'll update it later) and this issue didn't reproduce, the monster turned round successfully. XD, I'm very confused.

Can you please help me to find the answers of these two questions? Thanks very much!

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.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Animation Event Bug 1 Answer

Adding animation event at time instead of frame 0 Answers

Animation events firing all at once in mirrored blend tree 1 Answer

2D Animation does not start 1 Answer

How to detect if player hits enemy half-way into an 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