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 ina · Feb 18, 2013 at 08:03 PM · animation

Play Animation A after Animation B ends

How do you play one animation (Loop) after the other (Once) finishes?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by dorpeleg · Feb 18, 2013 at 08:54 PM

You can do something like this:

 gameObject.animation.Play("Once");    
 AnimationPlayed = true;    
 if (AnimationPlayed && !gameObject.animation.isPlaying("Once"){
     gameObject.animation.Play("Loop");
 }
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 ina · Feb 18, 2013 at 10:22 PM 0
Share

have you tested this? where are you putting this call

avatar image dorpeleg · Feb 18, 2013 at 10:32 PM 0
Share

I'm using similar code all the time.

Put this:

 gameObject.animation.Play("Once");    
 AnimationPlayed = true;


anywhere you want that animation to play.

Put this:

 if (AnimationPlayed && !gameObject.animation.isPlaying("Once"){
     gameObject.animation.Play("Loop");
     AnimationPlayed = false;
 }


in the update funcation.

avatar image ina · Feb 19, 2013 at 04:27 AM 0
Share

should .CrossFadeQueued be able to do something like this? it seems a resource-hog to have to use Update just to check if an animation has finished playing..

avatar image dorpeleg · Feb 19, 2013 at 12:50 PM 0
Share
 animation.PlayQueued("loop", Queue$$anonymous$$ode.CompleteOthers);

that should work.

if it still doesn't, maybe you should show us your code so we can understand.

avatar image ina · Feb 19, 2013 at 09:15 PM 0
Share

what if you have both idle loop and walking loops? Your code seems to only work for characters that by default go back to infinite idle.. prevents walk animation from looping.

Show more comments
avatar image
0

Answer by M_Joe · Feb 19, 2013 at 04:17 AM

You can ues Animation.CrossFadeQueued(animationName) or Animation.PlayQueued(animationName).

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 ina · Feb 19, 2013 at 04:27 AM 0
Share

That doesn't seem to work... Or maybe I'm not using it right?

avatar image
0

Answer by Ankit Priyarup · Mar 07, 2013 at 07:40 AM

You can add a float value in which the user will input duration and use wait second for playing that and destroy the old one

Comment
Add comment · 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

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

12 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

Related Questions

Can the animation editor create local rotational data? 3 Answers

Adding animation clips via script 2 Answers

Can I make animations snap to a frame? 1 Answer

How to select an animation clip by index number? 7 Answers

Left can Animate but right cannot. Why? 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