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
1
Question by Jonesy19 · Dec 02, 2016 at 03:53 PM · animationoptimizationloopanimationclipcache

How to play many animations at once without slowdown?

Hi everyone, I'm working on porting a game to Unity. As part of the original game, there are times when 100 animations play all at once. I have imported all of those assets into my game and have created code to play all of those animations at once. I basically run through a loop and play a different one on each iteration. Now, this actually works, but the first few times I go through the loop, there is about a second of lag. After 2 or 3 tries, it happens with no lag from there on out. I'm guessing because the animations are cached at that point.

1) Is there a better way to do this that I don't know about? Like I said, I am going through a loop, but maybe there is a better way?

2) Is there a way to force those animations into cache without playing them all?

Thanks everyone ahead of time!

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 Jonesy19 · Dec 05, 2016 at 06:41 PM 0
Share

Does anyone have any ideas on how to do this??

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by AurimasBlazulionis · Dec 05, 2016 at 09:51 PM

I assume you use animator. If you do not, then you really should switch to it. Another thing is that for all of the rigged 3d models you should check "Optimize GameObjects" box in the inspector. This allows animator be multi-threaded, it also removes all the transforms you do not need and puts mesh skinning on the GPU. For more information check out this talk.

For another question I believe unity loads all the data once you set the structure up (spawn the game object).

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 Jonesy19 · Dec 06, 2016 at 02:27 PM 0
Share

Thanks for the reply. I am using animator - but I guess I should have mentioned that I am using 2D animations...Would Optimize GameObjects work for 2D animations as well?

avatar image
0

Answer by cakeslice · Dec 05, 2016 at 10:10 PM

This is probably because Unity is loading all of those animations, after they load you can play them without issues.

The best way is to just do it at the start of the game (in a loading screen).

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 Jonesy19 · Dec 06, 2016 at 02:28 PM 0
Share

So to do this in a loading screen, are you saying I should put up a loading screen and then essentially create a scene behind the loading screen with all of the animations and play them?

thanks again.

avatar image cakeslice Jonesy19 · Dec 06, 2016 at 03:13 PM 0
Share

Yes, but if you load a scene after the loading screen, it's possible that Unity unloads the animations so this probably only works if you do it in the same scene (I'm not sure though).

avatar image
0

Answer by Jonesy19 · Jul 18, 2017 at 03:50 PM

Going back to part (1) of my initial question, is there a better way to run a ton of animations on duplicate gameobjects by looping through them all and essentially saying "animator.Play("animationName"). It definitely taxes the CPU here...

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

130 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 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

Animation keeps playing 2 Answers

Play animation if Player is close within certain distance. 1 Answer

Remove unused animation curves? (Animation.Update() optimizing) 1 Answer

Legacy Animation wont Loop 2 Answers

problem with facial animation 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