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
0
Question by Jonesy19 · Jul 17, 2017 at 04:24 PM · animation2danimatormecanimsprites

Is there a way to optimize animators?

Hi everyone, I have a 2D scene that has literally hundreds of gameobjects, each with an animator. When I go to the profiler, Animators.Update is taking up pretty much all of my CPU cycles. Now, I'm curious if there is a better way to do this, and if anyone knows...

I have changed all of the animators to CullCompletely, so they are only active when on screen. From what I have heard, using "Animations" rather than Animators is much more efficient, but I've also heard that you cannot use an "Animation" in 2d unless it goes into an animator.

Can anyone give me some guidance on where to go? Or is this a limitation of Unity?

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

3 Replies

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

Answer by RF008 · Jul 18, 2017 at 02:48 PM

i had the same issue with my game i have simply check if the animation game object is visibile to player

if visbile play animation or else disable animator compoenet.

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 · Jul 18, 2017 at 02:55 PM 1
Share

I ended up using the same tactic...CullCompletely certainly does not stop the CPU cycles like disabling the animator...I went from 70% CPU usage to 40% when I switched to CullCompletely. Then when I disabled the animators that weren't within a certain distance of the player, it went down to less than 10%...Amazing how much CPU the Animator $$anonymous$$ecanim uses...

avatar image
0

Answer by theANMATOR2b · Jul 17, 2017 at 08:05 PM

This will have to be tested for your specific game, because it depends..

Have you attempted to reduce animation frames in any of your imported animations? I don't know if that would help reduce overall cycles, but doesn't hurt to try.

Probably can reduce animated frames quite a bit, don't need a 30 fps animated swaying environment object.

Also might consider a tweening solution for things that can be 'tweened' instead of animations. Will have to be tested to see what is more optimal.

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 · Jul 18, 2017 at 02:56 PM 1
Share

This may have worked, but I ended up just disabling the animators (seemed like a simpler approach to start out with). I appreciate the response though!

avatar image
0

Answer by Shinugami · Aug 12, 2017 at 02:36 PM

The main way is to clamp values that are almost zero down to zero. This prevents multiple blends from being applied when it's not even noticeable to the player.

After that, I would recommend making an AI / Management script that sits in your scene and iterates through the active objects. Based on their distance, zone, visibility, activity etc you could change how much of their behavior is active and determine whether their animations are on or off. Culling is good but if you have animation events, such as footsteps, then you would need to be creative with how you play footsteps that are on culled AI. This is why I prefer to make my own culling method because the Unity Cull is not always ideal.

Think about what makes your AI inactive || active and set up a logic check to see what level of detail it qualifies for. If an AI is far from the player, legacy animations will be faster but this means you need to make a script to deal with legacy and one to deal with animator animations. Just make your game modular and disable objects that are not needed.

The management scripts are not too heavy, just set a cooldown for X amount of time between each iteration.Everytime the cooldown reaches zero, have the management script iterate through the active/inactive AI and determine what each AI should be set to. If it's heavy then you just increase the cooldown. Works well for me.

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

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

2D Animation does not start 1 Answer

How do I construct my animation state machine this way? 0 Answers

How would you handle the setup of my 2d character in Mecanim? 0 Answers

Getting with the times... learning Mechanim/Animator 1 Answer

Combo Attack Animations in Mecanim 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