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 Macro · Jul 28, 2014 at 08:50 AM · c#mecanim

Does Mecanim only change states after a frame?

So if I set a bool via the animator in script during an update method, does this get evaluated straight away in the mecanim controller or will the state change only occur after the update has finished?

I basically want to know how long the next animation will be in length (not normalized) so I can block input while it is playing, however I am not sure if I should be looking at CURRENT animation info or NEXT animation info after the setting of the bool.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Tehnique · Jul 28, 2014 at 09:28 AM

For blocking input, just make hashes for all animations that you want to block input for, put them in a list, and before accepting input, check if any of those animations are playing; and if so, ignore input. More info on hashes here.

EDIT: According to this (chart at the bottom), animation is updated after Update, and just before LateUpdate.

Comment
Add comment · Show 6 · 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 Macro · Jul 28, 2014 at 09:35 AM 0
Share

It is not a complete block I am after, I still need to listen for user input just not action it, as if they press PUNCH then $$anonymous$$IC$$anonymous$$ I need to make sure before the PUNCH animation ends it begins to transition into a $$anonymous$$IC$$anonymous$$, but I do not want it to process the $$anonymous$$IC$$anonymous$$ straight away, so basically I have an internal script bool which indicates if I am able to process the given input or not, however I need to basically wait 75% of the animation time then transition, hence why I need the animation time. As some animations may be 1 second, others may be 1.5 so the time delay is different for each.

avatar image Tehnique · Jul 28, 2014 at 10:46 AM 1
Share

You can do this with triggers. Basically, a trigger is a one shot bool for mecanim. A trigger is set from your code (like setting a bool to "true"), and once a $$anonymous$$ecanim transition consumes it (consumes = uses it as a condition), it is set back to false automatically. Triggers were recently introduced, and are very useful. $$anonymous$$ore on them here.

You can set your transition (from PUNCH to $$anonymous$$IC$$anonymous$$) conditions to "ExitTime = 0.75" and "$$anonymous$$icked" (this is the trigger), then set "$$anonymous$$icked" in the script, and once the time of PUNCH gets to 0.75, you will automatically transition to $$anonymous$$IC$$anonymous$$ (because the "$$anonymous$$icked" trigger is true and the PUNCH animation has played to the ExitTime).

avatar image Macro · Jul 28, 2014 at 11:20 AM 0
Share

Yep I had a forum post on that topic, however for the sake of this question can we look back at the original topic, does $$anonymous$$ecanim make its transition to the next state the moment you set a var or does it only take that change into account after the update scope has ended for the game object?

avatar image Tehnique · Jul 28, 2014 at 11:55 AM 1
Share

I'm not 100% sure, but according to this, it should happen after Update, just before LateUpdate.

avatar image Macro · Jul 28, 2014 at 03:33 PM 0
Share

I had not seen the flow chart at the bottom, do you want to put that down as the answer and will give you the points.

Show more comments

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

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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Mecanim Making an NPC walk 1 Answer

Mecanim Networking 0 Answers

How to access Blend Tree "speed" in Mecanim from C# 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