Static GameObjects Hierarchy

Hi everybody,

according to the documentation of static game objects, it is mentioned, that if a Game Object is not moving at all, it can be made static. By that, animation should not be done on such game objects, because it will move, which is understandable so far.

However, I was thinking about the following Game Object hierarchy. Imagine, we’re building an office building, with several rooms in it, so we may have a structure like this:

Office Building
  - Rooms
     - Room 1 (*)
       - Walls
         - Wall 1
         - Wall 2
       - Props
         - Chair 1
         - Chair 2
     - Room 2
     - Room 3

The player is able to build such a room, not by freely placing it, but by simply clicking a button and the room is made visible in its place. However, when building, the room should not only appear but have a entry animation (like falling from top to the ground).

Ok, within a room, nothing can be changed by the player, by that, all walls and props could be made static. The said animation would on the room itself (marked with a *). So technically, the walls and props will not move within their parent, but their parent will move.

Is it possible to mark the walls and props as static and still move the parent (which will indirectly? move the children as well). Can’t figure out, if that’s a common practice or simply not working. As far as I understand the docs, it’s not mentioned there as well.

Or is not moving on a static object a not moving at all within that hierarchy of the static game object?

Thanks!

Hi,

I’m still curious about this. Since I’m not that used too Unity yet, I’m struggling to find an answer myself.

If you like to have a group of object batched together you can use at runtime:

This allows to specify the root to which the objects will not move.

@fffMalzbier thanks for the link. However, this does not solve my initial question.

If its going to be moved - don’t mark it as static.
Static flags are for those specific purposes, like GI baking, Navmesh baking etc.

If you’re not using those, or not planning for using them - skip it.

Regarding performance - the only consideration is probably mesh combining, which can be done at any point in time manually via script.

Static batching can be replaced by the dynamic batching or instancing depending on the vertex count / platform.

@VergilUa Thanks for your answer, not sure if this answers my initial question.

I know about what Static is doing, but not sure how it does it within a hierarchy as mentioned above.

Only objects marked as static is affected. Meaning that static parent’s children probably will not be moved (I think, I haven’t tried myself).

Better approach is to separate dynamic and static objects into two groups. Mark static as static, and leave dynamic ones as is. You’ll be able to move all dynamic objects as single object as bonus.

Edit: As for the initial question - no, you can’t move static objects.