> For the complete documentation index, see [llms.txt](https://docs.engagevr.io/developer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.engagevr.io/developer/afx/afx-graphs/references.md).

# References

You can use a reference node to pass an object reference into a graph. For example, if you want to create an AFX graph that moves a cube in the scene, you can use a `Transform Reference` node to pass a reference to the cube into the AFX graph.

{% hint style="info" %}
You can also use reference nodes to pass objects from a parent graph into a subgraph. For more information, see [Adding inputs to an AFX subgraph](/developer/afx/afx-graphs/afx-subgraphs/adding-inputs-to-an-afx-subgraph.md).
{% endhint %}

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-687f885a2b931c8a164452de08aac6f301f891d7%2Fafx_reference_overview.png?alt=media" alt=""><figcaption><p>A Transform Reference node connected to a Translate node</p></figcaption></figure>

Each reference node has a field in which you can enter a reference name. A corresponding property will then be added to the AFX Object Reference Manager component when you attach the graph to a game object. As shown in the following image:

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-46316a01fba900ab52171c85a23bd49c4359f9b8%2Fafx_subgraph_inspector.png?alt=media" alt=""><figcaption><p>Example cube_ref transform field added to the AFX Object Reference Manager component</p></figcaption></figure>

## Adding a reference node to an AFX graph

1. Open the graph in which you want to add a reference node.
2. Right-click on the graph canvas to open the node dictionary, and then select the reference node that you want to use. For information about the available nodes, see [Reference](/developer/afx/node-dictionary/reference.md).
3. In the reference node, enter a name for the reference.
4. Select the game object that the AFX graph is assigned to.
5. In the **Inspector** panel, assign an appropriate object to the reference property that was added to the **AFX Object Reference Manager** component.

## Using the same reference in multiple nodes

If you use the same reference name in different reference nodes, they will refer the same object. However, this applies only to reference nodes that are within the same graph.

For example, in the following image both transform reference nodes have the same reference name (`cube_ref`), and so refer to the same object. This can be useful in large graphs where the alternative would be long connections between nodes.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-6ac87fe3cff6d86b10f5849bce8353340311c4be%2Fafx_multiple_refs.png?alt=media" alt=""><figcaption><p>Two reference nodes that refer to the same object</p></figcaption></figure>

## Variable components

Variable components provide important, complimentary functionality to reference nodes. You can add a variable component to a game object, and then use it as a reference in an AFX graph. The variable type of the component must match the variable type of the reference node.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-8d941bdd3c548cae54ce8e9e593ddf1c21f7b3f9%2Fafx_variable_component.png?alt=media" alt=""><figcaption></figcaption></figure>

Multiple AFX graphs can reference the same variable component. You can use this functionality to pass variable values between AFX graphs.

To add a variable component, complete the following steps:

1. In the **Hierarchy** panel, select the game object to which you want to add a variable component.
2. In the **Inspector** panel, select **Add Component**.
3. In the search field, enter `component`.
4. Select the variable component that you want to add.
