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
4
Question by SisterKy · Jul 20, 2011 at 12:44 PM · performanceoptimizationdisableenable

How resources-consuming are disabled things? How much drain puts enable/disable components/GOs on the system?

I asked this question before, but since I had a practical issue mixed in, I only got a solution for this particular problem but not a general answer. But I'm still interested and this question reminded me to go back to my initial inquiry... the >1.6k hits show, that I'm probably not the only one curious...

How much resources are consumed by disabled GameObjects?
How much resources are consumed by disabled Components?
How much strain does enable/disable of GameObjects put on the system?
How much strain does enable/disable of Components put on the system?

Greetz, Ky.

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

Answer by SilverTabby · Jul 23, 2011 at 10:59 PM

I don't have access to the Unity source code on enabling/disabling objects so I am not a true expert on the subject, but this is my experience from working with Unity:

  • Almost no CPU resources are spent on inactive GameObjects.

  • Almost no CPU resources are spent on disabled components.

  • Very minimal amount of effort is required by the cpu to activate and deactivate GameObjects.

  • Very minimal amount of effort is required by the cpu to enable and disable Components.

The only overhead a disabled Component or inactive GameObject has is RAM usage, which is not a problem on most modern machines. Besides, it was already using that amount of RAM when it was enabled anyways.

The reason for this is because a script will only use CPU time when a function is called or a value is changed. Disabling a script makes it so that Update and similar functions are not called. No functions are executed, therefore no CPU time is used.

An inactive GameObject works the same way: it only uses CPU time when a value is changed (such as it's transform position), a function on a script attached to it is called, physics and collisions need to be checked, or it needs to be rendered. None of these things happen when the GameObject is inactive.

Comment
Add comment · Show 4 · 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 SilverTabby · Jul 23, 2011 at 11:06 PM 0
Share

Also, Unity Pro has a feature that allows you to check cpu, memory, and gpu usage of everything in your scene. I'm too cheap to buy anything more expensive than the occasional pizza so I don't have specific numbers for you :(

avatar image SisterKy · Jul 26, 2011 at 02:34 PM 0
Share

Thank you very much =) This already helps a lot. accept

If anyone happens to have the smallchange and sparetime to check for numbers, that would be awesome though... =)

Greetz, $$anonymous$$y.

avatar image PixelPoolNL · Jul 14, 2016 at 02:29 PM 0
Share

How does RA$$anonymous$$ relate to mobile devices? The way i understand it it is always better to remove/init gameobjects when developing for mobile devices. Is this assumption correct?

avatar image Kabeza PixelPoolNL · Nov 08, 2016 at 03:55 AM 0
Share

PixelPoolNL I have probed that you NEED to remove the gameobjects in a development for mobile devices cause it drains all the RA$$anonymous$$, specially textures of 3D models.

avatar image
4

Answer by BTables · Aug 05, 2015 at 04:10 AM

SilverTabby's answer is only partially true. Disabled gameobjects cause a massive amount of CPU time if the parent of the transform is moved as unity still seems to need to calculate each transforms position in space regardless of whether it is active or not.

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 Nition · May 25, 2016 at 09:46 PM 1
Share

I'd also disagree with the claim that activating and deactivating GameObject's uses "very $$anonymous$$imal" CPU. It can actually be fairly intensive.

avatar image ninja_gear · May 25, 2016 at 10:02 PM 1
Share

To expand on this excellent answer, GameObjects only stop using their $$anonymous$$onoBehaviors. All other callbacks to that class/object (including transform change like suggested by Nition) along with events and other such things will still consume resources.

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

7 People are following this question.

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

Related Questions

Disable objects around the player? 2 Answers

Disable objects far away from player to make performance better 2 Answers

Performance Question, Change Boolean or Enable-Disable Script 0 Answers

Toggling a script on/off using the keyboard? 2 Answers

Why did my render time increase after lowering the vertex count? 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