You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When read in the editor, including during playmode, the isStaticproperty of a GameObject instance may be true or false depending on how the object is configured in the inspector. However, in builds, the property is always false. At least, I have observed it to be always false in Unity 2021.3f1.
The fact that runtime behavior is different between builds and the editor playmode can lead to subtle bugs, including the one I just spent the whole day debugging! It is fair to say that neither the property name nor the docs make this behavior discoverable. Honestly, I would prefer if Unity just crashed if the property were read from a build runtime, but a lint ban would do nicely.
There seems to be a decade's worth of grousing about this issue in the forums.
Proposed solution
Issue a warning any time isStatic is read from a GameObject instance, except when any of the following conditions are true:
Problem statement
When read in the editor, including during playmode, the
isStatic
property of aGameObject
instance may be true or false depending on how the object is configured in the inspector. However, in builds, the property is always false. At least, I have observed it to be always false in Unity 2021.3f1.The fact that runtime behavior is different between builds and the editor playmode can lead to subtle bugs, including the one I just spent the whole day debugging! It is fair to say that neither the property name nor the docs make this behavior discoverable. Honestly, I would prefer if Unity just crashed if the property were read from a build runtime, but a lint ban would do nicely.
There seems to be a decade's worth of grousing about this issue in the forums.
Proposed solution
Issue a warning any time
isStatic
is read from aGameObject
instance, except when any of the following conditions are true:#if UNITY_EDITOR
OnReset
orOnValidate
.The text was updated successfully, but these errors were encountered: