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
1
Question by Nition · Nov 04, 2013 at 11:14 PM · gameobjectstatic

Should non-rendered (code only) GameObjects be marked as static

Does anyone know if it's beneficial to mark non-rendered GameObjects as static?

For instance if I have a GameObject that only contains code - nothing that actually needs moving, lighting etc - does Unity still do some processing that'd be reduced by marking it as Static?

Comment
Add comment · Show 3
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 tanoshimi · Nov 04, 2013 at 11:26 PM 0
Share
  • Interesting question... I suspect it makes no difference if the object has no renderer/collider component attached, but I'd be interested to hear that confirmed.

avatar image rutter · Nov 04, 2013 at 11:51 PM 0
Share

Aside from renderers, colliders, draw call batching, lightmap builds, occlusion culling, and navmesh generation, I'm not aware of anything in Unity that takes the static flag(s) into account. In those circumstances, static/non-static matters a lot; outside of them, I'm pretty sure it matters none at all, or as near as makes no practical difference.

avatar image Nition · Nov 05, 2013 at 01:49 AM 0
Share

I just ran some tests myself to make sure and posted an answer. I can confirm that setting static for non-rendered objects has no effect.

2 Replies

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

Answer by Nition · Nov 05, 2013 at 01:48 AM

Answering my own question because I ran some tests on it.

I set VSync off and TargetFrameRate to unlimited, then spawned 100,000 GameObjects with a simple script on each that did nothing graphical. The scene also contained a camera and the original spawner object.

In a build, I could see no difference in framerate between having them static or not. In the editor, there might be a very slight difference, or I could just be imagining things. Either way it doesn't matter.

In short, setting static or not seems to have no effect on non-rendered GameObjects.

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 Josh707 · Nov 05, 2013 at 01:57 AM

It will have no effect if an object does not have a mesh renderer or particle system.

From the documentation: Unity can combine a number of objects at runtime and draws them together with a single draw call. This operation is called "batching". The more objects Unity can batch together, the better rendering performance (on the CPU side) you can get. Static batching allows the engine to reduce draw calls for geometry of any size (provided it does not move and shares the same material). If several objects shared the same geometry before static batching, then a copy of geometry will be created for each object, either in the Editor or at runtime. Currently, only Mesh Renderers and Particle Systems are batched.

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 · Nov 05, 2013 at 02:06 AM 0
Share

I assumed so but even with the documentation, I thought it possible that Unity could be doing some $$anonymous$$or internal stuff to all GameObjects since they all still have transforms etc. Checking the position of non-static objects each frame or something like that. Anyway, I've now tested and confirmed that yeah, setting Static or not has no effect on performance for non-rendered objects.

avatar image Josh707 · Nov 05, 2013 at 06:58 AM 0
Share

Yeah it's always worth just trying stuff out to see what happens anyways!

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

18 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

Related Questions

Static List< GameObject> in Singleton 1 Answer

Why is text ui cant be static ? 0 Answers

GameObject Static & Active Flags 1 Answer

static weapons? 1 Answer

GetInstanceID ?????? 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