S&box Wiki

Instances

What are instances?

Instances are slightly different than prefabs and have their own merits. It's worth noting that it too can contain both models, geometry, and/or entities. The biggest difference is that it cannot be referenced from any other map but the one it is created within. It is local to the current VMAP.

Benefits

One of the benefits to instances is rendering. Much like models, where if the same model is repeated over and over again it will be batched up into a single rendering pass, instances are handled the same way. Geometric detail that is instanced and repeated is batched together for rendering purposes.

Another benefit is that when editing instances the changes can be seen immediately to all the surrounding same instances. If a house is an instance and a window is added that change is instantly duplicated to all the other instances.

Creating Instances

  1. Select a number of objects and/or meshes
  2. Right click to bring up the context menu and Selected Objects -> Create Instance

You could press the hotkey ctrl + ⇧ shift + g to quickly create an Instance.

creatinginstances.png

Editing Instances

Double click on an instance to edit it. Any changes to the instance will be reflected live to all other instances inside the map.

Collapsing Instances

Right click on an instance Selected Objects -> Collapse Instances. Similar to collapsing a prefab the collapsed instance will leave behind all the individual objects and meshes.