# Object references

It's a common pattern in Unity to reference objects and components from one Prefab to another. A simple example is Cinemachine: to target an object with a camera, you normally assign that object's Transform to the **Tracking Target** property of a CinemachineCamera.

<figure><img src="https://3055962393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzOOVmLdEeVhfPmrcckJe%2Fuploads%2F51PyVYhojbZr0NvQMlcG%2FScreenshot%202024-08-14%20alle%2018.47.49.png?alt=media&#x26;token=b4e7846d-5875-41a1-8492-f49301b15582" alt="" width="563"><figcaption><p>A CinemachineCamera needing to reference a Transform as a target</p></figcaption></figure>

But how to do it when the object you want to assign simply isn't visible, because it's a child of a locked Prefab?

This is why you might want to expose an object reference on the BlackBox. When you do so, the reference will be visualised as an ObjectField without the little circular "picker icon":

<figure><img src="https://3055962393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzOOVmLdEeVhfPmrcckJe%2Fuploads%2FHxhSlPVFZDa8hHumWjeD%2FRefToObj_External.png?alt=media&#x26;token=597a7b40-a689-4b94-9ad4-0269889afeea" alt="" width="563"><figcaption><p>The object reference as seen on the BlackBox component, in the scene</p></figcaption></figure>

From here, you can simply right-click on the field and choose **Copy**, and then paste where you need this reference.

{% hint style="success" %}
You will notice that trying to change the reference or nulling it shouldn't work, so you can't break the reference involuntarily with an override while you work on the Prefab.
{% endhint %}

## Revealing object references

To reveal a reference, you can do it in two ways:

### On the BlackBox component

Click on the **Show Available Properties and Methods** button on the BlackBox, and expand the foldouts until you arrive to the gameObject or component you're interested in.

Object References are preceded by a small **\[R]** letter:

<figure><img src="https://3055962393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzOOVmLdEeVhfPmrcckJe%2Fuploads%2FFsbtxlH3prXc6Dv0bb7p%2FRefToComp_OnBlackBox.png?alt=media&#x26;token=9f0a3b70-fd05-418d-90dd-65b3fc3f8e9c" alt="" width="563"><figcaption></figcaption></figure>

Press the **\[+]** button to add the component or gameObject to the reveal list.

### Via the context menu

References to components can also be revealed in context. While you have the right GameObject selected, right-click the component's title bar and choose **BlackBox > Reference to Component > Reveal in...**, like so:

<figure><img src="https://3055962393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzOOVmLdEeVhfPmrcckJe%2Fuploads%2FyOLP4xWOWFdhhXisYnNN%2FRefToComp_Context.png?alt=media&#x26;token=135bd984-24e7-4558-b6f1-2e90a1b567a9" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
**First List, Second List... what are they?**

Unfortunately, a Unity limitation means we can't display the custom names that you might have assigned to [Reveal lists](https://tools.continis.io/black-box/main-features/reveal/reveal-lists), and that's why they are displayed as First List, Second List, etc. up to 5 lists.

To add components to a higher number list, you can move the list in one of the first 5 positions, add the component, and move it back (using the reorder buttons in [Edit mode](https://tools.continis.io/black-box/main-features/reveal-lists#edit-lists)).
{% endhint %}
