- Home /
Switching GameObject between static and non-static
We have a boardgame-like game, where the gameboard tiles are changing every now and then, but not constantly. Is it a common way to do things to programmatically mark tiles that are not changing static and when they have to be changed, back to non-static?
Answer by Pengocat · Jan 25, 2017 at 02:33 PM
The purpose of static is to do pre-optimisation at build-time not run-time. This means that if you enable or disable static objects at runtime the things part of the static parameter won't be updated.
Lightmapping
Occluder and Occludee
Batching
Navigation
Off-Mesh Links
Reflection Probes
That does not mean that it isn't possible to do some optimisations at run-time like combining meshes, but you need to handle the updating yourself I would guess and doing any of this during game-play would most likely cause major frame-drop so it has to be done during loading. I recommend you only mark things that are persistent as static and everything else leave it as non-static. Lightmapping normally takes minutes or even hours so it would probably never be feasible to do at run-time.
Note that the dropdown arrow next to the static checkbox is used to check each of the before mentioned parameters individually.
Why is there this chance to tweak it anyways, if it has no effect?
Answer by stickstones · Jan 25, 2017 at 03:27 PM
The static checkbox? "Is it a common way" - no, well, I've never used it. It's only been there since unity 5 (i think). It's nice to see pengocats answer which explains what it is.
Your answer
Follow this Question
Related Questions
Calling gameobject.transform vs. just calling transform directly - Performance negligible? 1 Answer
How to optimize game performance in this code? 1 Answer
Assigning to global transforms of current gameobject 1 Answer
HELP!!!! GetAxis to Accelerometer :) 0 Answers
Unity 2019.1 LWRP sample scene fps problem on Huawei Y9 2018 1 Answer