# targetPrefabId

> The ID of the prefab instance that contains the referenced object.

## Definition

* **Type:** Property
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public ulong targetPrefabId { get; }
```

### Remarks

Adding a new prefab instance to a scene creates a new instance of every object the prefab contains, including every GameObject. The GameObject inside a prefab instance doesn't have its own stable local file ID and a single prefab can be instantiated multiple times in a scene. Therefore, to reliably identify a GameObject that's part of a prefab requires both the local file ID of the original version of the GameObject (targetObjectId) and the ID of the particular prefab instance it belongs to (`targetPrefabId`).

For more information on creating prefab instances, refer to [Creating Prefabs](/engine/6000.0/manual/working-with-gameobjects/prefabs/creating.md) in the Manual.

The `targetPrefabId` constitutes the `{p}` element in the string representation of a `GlobalObjectId`, the format of which is:

`GlobalObjectId_V1-{i}-{a}-{l}-{p}`

Additional Resources: [PrefabUtility.IsPartOfAnyPrefab](/engine/6000.0/script-reference/unityeditor/prefabutility/ispartofanyprefab.md)
