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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Bartol0ll0 · Jul 27, 2014 at 10:36 AM · animationsswitchcombo

Animation ignores yield and plays next one

I have script,that plays animations according to "tap" value.I wanted to wait for these animations to end before playing next so I have added yield,but it doesnt change anything.Here's Script

   void Update(){
             timer = Time.timeSinceLevelLoad;
             if (tap == 0){
                 anim.SetInteger ("Yatak",0);
             }
                     if (Input.GetKeyDown (KeyCode.J)){
                     LastPress =   Time.timeSinceLevelLoad;
                     if (tap > 2){
                         tap = 1;
                     }else{
                         tap++;
                     }
                     StartCoroutine(ComboJ());
                 }
                 if(timer - LastPress > 1){
                     tap = 0;
                     if(timer - LastPress < Atime){
                         attack = false;
     
                     }
                 }else{
                     attack = true;
                 }
             }
     IEnumerator ComboJ (){
             if(attack){
                 switch (tap){
                 case 0:
                     anim.SetInteger("Yatak",0);
                     break;
     
                 case 1:
                     Atime = 1f;
                     anim.SetInteger("Yatak",1);
                     yield return new WaitForSeconds(1f);
                     break;
     
                 case 2:
                     Atime = 1f;
                     anim.SetInteger("Yatak",2);
                     yield return new WaitForSeconds(1f);
                     break;
     
                 case 3:
                     Atime = 0.35f;
                     anim.SetInteger("Yatak",3);
                     yield return new WaitForSeconds(0.35f);
                     break;
                 }
             }
         }
 
 
 
 
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
0

Answer by smallbit · Jul 27, 2014 at 11:38 AM

Would be nice to see your mecanim. I think that you can setup animation to swtich after its finished by adding two conditions in the mecanim transition. One will be the default one that is there after creating transition (Time > x:xx) which will trigger once clip is finished. And other One will be your Integer. This should assure your animation to switch only once clip is finished.

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 Bartol0ll0 · Jul 27, 2014 at 07:15 PM 0
Share

That's how $$anonymous$$ecanim looks:alt text

Idle goes to Yatak1 if Yatak equals 1,then from Yatak1 it goes to Yatak2 if Yatak equals 2,and its the same for Yatak3, and everything comes back to Idle if Yatak equals 0.

mecanim.png (75.9 kB)

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

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Help needed with scripting an enemy 0 Answers

Camera elements 2 Answers

how to make one script with different animations attached 2 Answers

Trouble with Null Reference in Script 2 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