# TryGetObjectIdentifier

> Tries to convert a persistent Object into an ObjectIdentifier.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Build.Content](/engine/6000.3/script-reference/unityeditor/build/content.md)
* **Assembly:** UnityEditor

## TryGetObjectIdentifier(Object, ObjectIdentifier)

Tries to convert a persistent Object into an ObjectIdentifier.

```csharp
public static bool TryGetObjectIdentifier(Object targetObject, out ObjectIdentifier objectId)
```

### Parameters

**** (\[Object]\(/engine/6000.3/script-reference/unityengine/object)): **** (\[ObjectIdentifier]\(/engine/6000.3/script-reference/unityeditor/build/content/objectidentifier)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

Returns false if it was not possible. This can happen if the Object is is a Scene Object, or was not loaded from and Object on disk.

## TryGetObjectIdentifier(int, ObjectIdentifier)

Tries to convert a persistent Object into an ObjectIdentifier.

```csharp
public static bool TryGetObjectIdentifier(int instanceID, out ObjectIdentifier objectId)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): **** (\[ObjectIdentifier]\(/engine/6000.3/script-reference/unityeditor/build/content/objectidentifier)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

Returns false if it was not possible. This can happen if the Object is is a Scene Object, or was not loaded from and Object on disk.
