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 question was closed Feb 11, 2014 at 06:00 PM by Rick74 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Rick74 · Feb 11, 2014 at 05:28 PM · javascriptanimations

Playing one animation after another, JS

Hey guys, I did a search and couldn't find anything out there that made sense to my situation.

All I'm trying to do is get one animation to play, stop, then play another animation...all with in a function within JS.

 function Intro ()
 {
     speed = 0.4;
     animation.Play("IntroWalk");
     yield WaitForSeconds (2);
     speed = 0;
     animation.Stop();
     animation.Play("IntroIdle");
     PlaySound (sayHello, 0);    
     yield WaitForSeconds (5.1);
 }

What I'm expecting to have happen here;

play the walk animation for 2 seconds, stop, then play the idle animation.

What actually happens;

plays the walk animation for 2 seconds, gets frozen in the first frame of the idle animation.

I am confused here. Any clarification as to why this won't work?

Comment
Add comment · Show 2
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 Rick74 · Feb 11, 2014 at 06:01 PM 0
Share

Never$$anonymous$$d, I figured it out. I added each animation to a boolean statement under the update, and then I turn them on/off as needed.

avatar image DajBuzi · Feb 11, 2014 at 06:03 PM 0
Share

You have many options to acieve what you want but i'll describe 2:

1-> ins$$anonymous$$d of using yield waitforseconds you can make timeDelay variable add it into actual Time.time and if this actual Time.time is equal or greater than your delayed time -> switch animation (it's the easiest way in my opinion).

2-> you can use animator and trigger actions through events or count how lojgthis animation should play to start another one etc.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

19 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

Related Questions

Play animation when transform is moving? [JS] 0 Answers

User Created Animations Not Working With Mecanim 0 Answers

Animated camera problems 0 Answers

Setting Scroll View Width GUILayout 1 Answer

Creating animations and objects for Unity 1 Answer


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