# TryGetObjectIdentifier

> Tries to convert a persistent Object into an ObjectIdentifier.

## Definition

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

## 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.7/script-reference/unityengine/object)): The Object to look up.**** (\[ObjectIdentifier]\(/engine/6000.7/script-reference/unityeditor/build/content/objectidentifier)): Out parameter with the found object identifier.

### Returns

| Type                                                          | Description                                                                        |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if an object identifier was found for the specified Object. Otherwise, false. |

### Remarks

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

## TryGetObjectIdentifier(EntityId, ObjectIdentifier)

Tries to convert a persistent Object into an ObjectIdentifier.

```csharp
public static bool TryGetObjectIdentifier(EntityId entityId, out ObjectIdentifier objectId)
```

### Parameters

**** (\[EntityId]\(/engine/6000.7/script-reference/unityengine/entityid)): The object identifier's entity id to look up.**** (\[ObjectIdentifier]\(/engine/6000.7/script-reference/unityeditor/build/content/objectidentifier)): Out parameter with the found object identifier.

### Returns

| Type                                                          | Description                                                                           |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if an object identifier was found for the specified entity ID. Otherwise, false. |

### Remarks

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