Instancing Nodes
The virtual world, that you're building, may contain a lot of identical objects, that should always look the same, such as electricity pylons, planes, wheels, boxes, etc.
When you clone these objects and place them in your world, multiple separate copies are created. Thus, if you decide to change something (e.g., the geometry or materials of some parts of the pylons) you'll have do that for each copy individually.
Instead of making copies of an object, it is recommended to make instances of a single one. Such approach ensures integrity when changing the parameters of the repeatedly used objects, especially if they are complex and sophisticated. To do so, You can simply add several node references referring to a single *.node file and then edit only one node reference in order to update all of them.
Below is the typical workflow for node instancing based on node references.
1. Creating a Hierarchy of Nodes#
First of all we should prepare the basic hierarchy, that will represent our object. Suppose we have organized the nodes hierarchy for a helicopter, that we are going to reuse several times in our world (see the picture below)
2. Converting the Hierarchy of Nodes#
The second step is to convert the hierarchy of nodes to a node reference. You can do that by simply dragging the root node of the hierarchy to the desired folder in the Asset Browser. A corresponding *.node asset (source), containing the hierarchy, will be created in the folder. The node hierarchy will be replaced with a reference to this asset.
You can also convert a single node or a group of selected nodes in the World Hierarchy window via the context menu. To do so, select the desired node(s) in the World Hierarchy window, right-click on the selected node and choose Create a Node Reference. A corresponding *.node asset (source), containing the selected node (or a group of nodes as children with a dummy node as the root), will be created in the current folder opened in the Asset Browser. Selected nodes will be replaced with a reference to this asset.
3. Placing Instances#
So, we already have the first instance in the world. It's the one, that replaced the hierarchy, when we dragged it to the Asset Browser. To add other instances to the world, we can simply drag the desired *.node asset from the Asset Browser directly to the Scene Viewport.
4. Editing the Source Node from its Instances#
If you decide to change something in the source node, you can do that by editing any of its instances. To do so, perform the following steps:
Select any instance in the world via the Scene Viewport or the World Hierarchy window. The parameters of the node reference will be displayed in the Parameters window.
Click Edit. The hierarchy of the source node will be displayed in the World Hierarchy window.
Edit the source node. You can make any changes: modify materials, add new nodes, remove existing ones, etc.
Click Apply to save changes made to the source node or Cancel to discard them. The changes will be applied to all instances at once.