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 the node references will enable to avoid manual editing each identical object if you need to make the same changes in all of such objects. 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 the repeated objects, especially if they are complex and sophisticated.
For example, the node references can be used to add identical cars, boats or buildings that should be updated at once, if necessary.
Creating a Node Reference
There are 2 ways to create a node reference via UnigineEditor:
- Add a new node reference that refers to an external .node file. In this case, you will need to export a node into a .node file first.
- Convert a node with all its child nodes presented 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 the node references. Or you can simply clone the added one: 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 will be converted into the node reference:
Source Node to be Converted
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
On the Reference parameters of the Node tab you can change the asset of the source node or open the ReferenceNode Editor used to edit the source node:
UnigineEditor features a special ReferenceNode Editor, which enables to edit the source node to which the node reference is pointed. To edit the source node:
- Select the node reference in the World Hierarchy window.
- Open the ReferenceNode Editor by clicking Edit in the Node tab of the Parameters window.
ReferenceNode EditorSource node in the edit mode
- Edit the source node. For example, you can change the material applied to it:
Node references with the yellow material appliedNode references with the changed material
- Click Apply to save changes made to the source node or Cancel changes to cancel them.
Deleting a Node Reference
You can delete the node reference the same way as any other node.