> For the complete documentation index, see [llms.txt](https://docs.coherence.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coherence.io/manual/networking-state-changes/coherence-sync-references.md).

# Entity references

coherence is able to network references to other instances of Networked Prefabs.&#x20;

To do so, network any variables or methods using `GameObject` or any `Component` type:

<figure><img src="/files/E3C84mWd6jmWOEPee9mh" alt=""><figcaption></figcaption></figure>

### Limitations

It's important to know about the situations when a Networked Prefab reference might become null, even though it seems like it should have a value:

* A client might not have the referenced entity in its CoherenceLiveQuery. A local reference can only be valid if there's an actual Entity instance to reference. If this becomes a problem, consider switching to using the [CoherenceNode](/manual/networking-state-changes/parenting/deeply-nested-entities.md) component or [Parent-Child relationships](/manual/networking-state-changes/parenting/direct-children.md) of prefabs, which ensures that that Entity stays part of the query.
* The owner of the Entity reference might sync the reference to the Replication Server before syncing the referenced Entity. This will lead to the Replication Server storing a null reference. If possible, try setting the Entity references during gameplay when the referenced Entities have already existed for a while.
* **Cyclic references** are **undefined behavior** for now. Therefore multiple entities created on the same Client that reference each other might never get synced properly. This is also holds true for references that exist through intermediate entities (A has reference to B has reference to C has reference A - cyclic).

When working with entity references, behind the scenes coherence is resolving the `CoherenceSync`/`EntityID`. This means that when working with prefabs that have **multiple components of the same type**, the component resolved might not be the component expected, but the first one that `GetComponent<T>` is able to resolve.

In any case, it's important to use a defensive coding style when working with Entity references. Make sure that your code can handle missing Entities and nulls in a graceful way.
