Node Reference
A Node Reference is a node that refers to an external .node file on the disk, which is obtained by exporting a node from the world.
The node references should be used if there are a lot of identical objects that are repeated in the world. Using node references enables to avoid manual editing each identical object if you need to make the same changes in all of them. You can simply add several node references that point to one .node file and then edit only one Node Reference in order to update all of them. Such approach enables to hold to integrity of instanced objects, especially if they are complex and sophisticated.
For example, the Node Reference can be used to add identical cars, boats, or buildings that should be updated at once, if necessary.
See Also#
- The Instancing Nodes article to learn more about using node references to create identical objects.
- The NodeReference class to edit node references via API
- The Randomizer plugin to work with multiple node references
Creating a Node Reference#
There are two ways to create a Node Reference via UnigineEditor:
-
Add a new Node Reference that refers to an external .node file. In this case, you should export a node into a .node file first.
On the Menu bar, click Create -> Node -> Reference.
- Convert a node with all its child nodes present in the nodes hierarchy list into a Node Reference. In this case, the source node will change its type to a Node Reference.
By Importing a New Node Asset#
- Click the Import button in the Asset Browser window and choose the desired node in the file dialog window that opens.
- Place the Node Reference in the world.
You can repeat Step 2 in order to add the required number of node references. Or you can simply clone the added node: select the Node Reference and press Ctrl+D.
By Converting an Existing Node#
- Select a node in the World Hierarchy window (or directly in the scene).
- On the Menu bar, click Edit -> Convert to NodeReference (or press Ctrl+Shift+G).
As a result, the source node is converted into the Node Reference:
Source node to be converted
|
Converted node
|
You can also clone the converted node in order to get the required number of node references.
Source nodes to be converted
|
Nodes grouped under a dummy node to which Node Reference refers
|
Editing a Node Reference#
In the Reference section of the Node tab, you can change the asset of the source node or open the ReferenceNode Editor used to edit the source node:
To edit the source node, to which the Node Reference points:
- Select the Node Reference in the World Hierarchy window.
- Click Edit in the Node tab of the Parameters window.
World Hierarchy window: source node in the edit mode
- Edit the source node. For example, you can change the material applied to it:
Node references with the red material appliedNode references with the changed material
- After all changes are made, select the parent node in the World Hierarchy window and click Apply to save changes to the source node or Cancel changes to keep nodes unchanged.
Reference section in the Node tab of the parent Node Reference
Deleting a Node Reference#
You can delete the Node Reference the same way as any other node.