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 rsoneriu · May 07, 2014 at 06:53 AM · animationperformance

Animation or script transforming?

Hello guys,

I have been looking for an answer to this or for a similar topic on multiple sites and even though I did manage to find quite nice tutorials on how to do one or the other, none of them answered the following question: What is better (performance wise) to have? animation of an object or to just script it to transform position and rotation (so that he actually moves by a fixed amount every frame or second). Especially when it comes to complex movements, like rotation (make it rotate exactly 2 times around z or x axis) and so on?

Animation provides more control on the movement, number of occurrences, speed and so on, but how does that translate performance wise? From my previous experience in programming (not unity), I know that making things be done at runtime by script is a lot better performance-wise. However, I have never worked with animation so this really bugs me.

What is your opinion? Many thanks!

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
2
Best Answer

Answer by Andres-Fernandez · May 07, 2014 at 08:28 AM

I can't talk numbers, or the theory, but I can tell you that from my experience, animation clips perform a lot better if the amount of objects to move by code is big.

In one of my last projects there where nearly 50 objetcs that were being translated and rotated by code (using itween if I'm not mistaken) and those translations had to loop indefinitely. What I found was that every time a translation by code ended and new one started there was a huge peak in the performance (tens of milliseconds, maybe a hundred) due to itween elements being destroyed and created again. I created an animation (with an editor script, to make objects translate along same path as the script), set the loop and applied to all the objects. Peaks disappeared.

Maybe it was because of the use of the itween library, but using animation clips made the game run a lot faster than controlling the movement of all the objects by script.

Comment
Add comment · Show 2 · 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 rsoneriu · May 07, 2014 at 08:54 AM 1
Share

$$anonymous$$any thanks for your answer! This was something I was also kinda felling it's the case, that an animation would use lesser or in the worse case the same amount of resources, but it allows for a better customisation of the movement of the object.

avatar image jimmy12day rsoneriu · Jan 09, 2019 at 07:33 PM 0
Share

Projects varies. Those are all situational. If like simple rotation, script can adjust rotate speed and call script in Update can modifed by &frameCount which can reduce cost per second.

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

22 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

Related Questions

Adding animation clips via script 2 Answers

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

Best Practice For Shader Complexity + IOS 1 Answer

Photon Multiplayer Animations 2 Answers

Scripting animations 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