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
2
Question by Cherno · Jan 15, 2017 at 06:43 PM · cameraspriteanimatorrender

Any way to make Animation.Play take effect immediately?

First of all: This is NOT about how to avoid transitions between animationStates.

Now, the issue at hand:

I am coding a doom-style game with multi-directional sprites and multiple cameras. That means that I use OnPreRender on each camera to make each sprite face the camera. So far, so good. Now I I also need to play the right animation for each camera. For example, "Idle" has 8 seperate states/clips for each of the 8 viewing angles. Problem is the frame execution order.

First, All Animations are updated Only then is the scene rendered.

In OnPreRender, I call Animatior.Play to play the correct viewing angle state. Unfortunately, this only takes effect in the next frame so the sprite as it is rendered is always in the state of the last Camera's OnPreRender call,

Example:

 Frame 0:
 
      [OnPreRender]
      Camera 1:
      Play anim for camera angle 1
      Camera 2:
      Play anim for camera angle 2
 
 Frame 1:
      [Animaton Update]
      Animation for camera angle 2 (last one played) takes effect
 
      [OnPreRender]
      Camera 1:
      Play anim for camera angle 1 (takes effect in next frame!)
      Camera 2:
      Play anim for camera angle 2 (takes effect in next frame!)
 
      [Render]
      Camera 1:
      Renders sprite, which is playing viewing angle 2 animation
      Camera 2:
      Renders sprite, which is playing viewing angle 2 animation

Is there any way to make the animation play immediately so it can get rendered, without having to wait for the next frame's animation update phase? The only other solution I can think of is to have seperate sprites for each camera.

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 bourriquet · Apr 08, 2018 at 07:31 AM 0
Share

I am also looking for a way to do this. Any solution?

2 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by bourriquet · Apr 08, 2018 at 08:20 AM

Animator.Update (0f);


This is the key!

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
avatar image
0

Answer by tormentoarmagedoom · Apr 08, 2018 at 07:52 AM

Good day.

There is an option to play automaticly once the object is instantiated.

Check this post.

Byee :D

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

108 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

Related Questions

MissingComponentException after changing Animator component. 1 Answer

HDRP Camera weapon layer 1 Answer

Sprite collor don't change on animation 0 Answers

Sprites always facing camera problem - sprite manager 2 possibility. 3 Answers

Calling Render() twice using the same camera 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