Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
5
Question by berkc · Apr 30, 2017 at 05:29 PM · animationwaitforseconds

Animation Window Time Unit

I made an animation to a GameObject as seen below:

Animation Window

I want to do something in a script at the exact time when animation reaches to 0:40. I tried to use yield return new WaitForSeconds(0.4f); but it didn't work because it caused some delays. My question is:

  • What does 0:10 in animation window corresponds to in seconds? I don't think it's miliseconds since 1 second = 1000 miliseconds.

  • How many seconds do I have to wait until animation reaches to 0:40?

an.png (43.3 kB)
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

2 Replies

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

Answer by FM-Productions · May 05, 2017 at 01:31 PM

Hi,

simply set an animation event for your animation at the right time. It should call the corresponding function of the script attached to your animated object. Here is the tutorial:

https://docs.unity3d.com/Manual/animeditor-AnimationEvents.html

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 berkc · May 14, 2017 at 09:05 PM 0
Share

I haven't tried this yet but I think it will solve my problem. I will let you know when I try it.

avatar image
11

Answer by Hellium · Apr 30, 2017 at 05:30 PM

The values in the animation panel must be read as follow :

  • The first number indicates the seconds, rounded down

  • The second number indicates the frame number of the current second

Thus, "0:40" must be read as dollow : "40th frame of the first second"

Supposing you have set "60" in the "Sample" input field next to your animation name, in the Animation panel, then your animation is running at 60 frames per second. That's why you have :

"0:00", "0:10", "0:20", "0:30", "0:40", "0:50", "1:00"

Thus, you will have to wait : 40/fps seconds = 40/60 seconds ~ 0.6667 seconds

Comment
Add comment · Show 3 · 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 berkc · May 14, 2017 at 09:04 PM 0
Share

I tried it but I still observed a delay. I think it is related to how Unity manages animations and coroutines.

avatar image marcospgp · Dec 12, 2020 at 07:29 PM 0
Share

Where can this info be found in the documentation?

avatar image Hellium marcospgp · Dec 12, 2020 at 08:35 PM 1
Share

https://docs.unity3d.com/$$anonymous$$anual/animeditor-AnimatingAGameObject.html

Time line

You can click anywhere on the Animation window time line to move the playback head to that frame, and preview or modify that frame in the Animation Clip. The numbers in the time line are shown as seconds and frames, so 1:30 means 1 second and 30 frames.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Loop Animation with delay-variable 1 Answer

Javascript; Wait for animation 1 Answer

How do I make the animation play once then change scene? 0 Answers

Gun script help 1 Answer

Loop animation with a wait in between 3 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