Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by remanam · Jan 18 at 06:37 AM · animatorparametersanimation controller

Why my animator is freezzed after WaitForSeconds(Delay)

I have a character with Movement and Attack script. I set animations with bool parameters.

After i Get damage animator is set TakeDamage animation buy won't play until WaitForSeconds(Delay), Why?

This is my code alt text public void TakeDamage(int damage) { healthScript.GetDamage(damage);

     StartCoroutine(SetTakeDamage());
     
     //getDamageSound.Play();
     ifGotDamage = true;

     if (healthScript.health == 0)
     {
         Die();
     }

 }

 IEnumerator SetTakeDamage()
 {
     anim.SetBool(AnimationTags.TAKE_DAMAGE_PARAMETER, true);

     yield return new WaitForSeconds(takeDamageFrequency);

     anim.SetBool(AnimationTags.TAKE_DAMAGE_PARAMETER, false);
 }


unity-ttuwc2yetc.png (40.2 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 remanam · Jan 22 at 09:01 AM 0
Share

So i solved the problem by changing bool parameter to trigger. After that animations from AnyState are working propely.

But another problem came. Because trigger doesn't have "False" condition i can't transition to idle entry state

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by privatecontractor · Jan 19 at 03:15 PM

Hi @remanam,

more or less: " yield return new WaitForSeconds(takeDamageFrequency);" will stop Animator for takeDamageFrequency seconds.... so you can try code below, maybe it will help.

 IEnumerator SetTakeDamage()
 {
     float _remainingTimeToAnimDamage = takeDamageFrequency;
     while (_remainingTimeToAnimDamage > 0)
     {
         anim.SetBool(AnimationTags.TAKE_DAMAGE_PARAMETER,
         true);
         _remainingTimeToAnimDamage -= Time.deltaTime;
         yield return null;
     }
     anim.SetBool(AnimationTags.TAKE_DAMAGE_PARAMETER,
     false);
     yield return null;
 }
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 remanam · Jan 19 at 03:43 PM 0
Share

thanks, i will try!

avatar image remanam · Jan 22 at 07:29 AM 0
Share

Actually it didn't help, animator was frezzed until takeDamageFrequency

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

208 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 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 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 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 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 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 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 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 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

Can I make a prefab have different sprites based on what direction it is facing? 1 Answer

I draged to far from the animator, how can I come back? 1 Answer

inspector GUI in animator bugged when trying to add behaviour 2 Answers

Animation not playing specific bones 1 Answer

Can't rearrange animation parameters 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