- Home /
When is a static game object static?
I'm using Unity 4.6.8 and programming for a mobile device.
I have 10 cube objects in the scene with the static toggle button set to true in the inspector. Now I click "play" in the editor.
After three seconds, I also instantiate 10 cube game objects with (static = true) in the scene.
The first ten objects are static. Are the instantiated ten objects also static? They are instantiated later.
You can check it by pausing game and clicking Cloned gameObject. Inspector window will show you the details just like other objects. Also you can check with GameObject.isStatic
I think, that my question is not well explained. When instantiating objects and setting static to true programmatically are the instantiated objects the same like the first ten cubes that are set in the editor? Performance, memory etc.
I read somewhere, that when the scene starts, the objects that set to static are good for performance, memory etc. But the other 10 cube objects are instantiated. Will they have the same performance, memory etc.?
That depends. When you set object as static in the Editor, Unity will include that object while baking the lightmap. There is no lightmapping in runtime so, that object will use realtime lights. But Draw Calls will be decreased.
Answer by meat5000 · Nov 22, 2015 at 12:33 PM
But, it not tells, what happens with instantiated objects and set static to true of this objects in game.