# LoadableObjectIdEditorUtility

> Editor utilities for creating and converting LoadableObjectId values when authoring content.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor](/engine/6000.7/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public static class LoadableObjectIdEditorUtility
```

## Remarks

[LoadableObjectId](/engine/6000.7/script-reference/unity/loading/loadableobjectid.md) is the low-level reference type used by [Loadable\<T>](/engine/6000.7/script-reference/unity/loading/loadable1.md) for on-demand object loading. These methods convert between live [Object](/engine/6000.7/script-reference/unityengine/object.md) instances and serialized loadable object IDs for content directory builds.

Use this utility to populate a root asset or a [LoadableObjectId](/engine/6000.7/script-reference/unity/loading/loadableobjectid.md) field from a script. It is also useful when implementing custom Editor UI for ScriptableObjects or MonoBehaviours that contain [Loadable\<T>](/engine/6000.7/script-reference/unity/loading/loadable1.md) or [LoadableObjectId](/engine/6000.7/script-reference/unity/loading/loadableobjectid.md) fields.

Additional Resources: [LoadableObjectId](/engine/6000.7/script-reference/unity/loading/loadableobjectid.md), [Loadable\<T>](/engine/6000.7/script-reference/unity/loading/loadable1.md), [LoadableSceneIdEditorUtility](/engine/6000.7/script-reference/unityeditor/loadablesceneideditorutility.md)

## Examples

```csharp
using Unity.Loading;
using UnityEditor;
using UnityEngine;

namespace BuildDocExamples
{
    // Example showing how to use LoadableObjectIdEditorUtility to convert between Objects and LoadableObjectIds
    public class LoadableObjectIdEditorUtility_Example
    {
        public void ConvertObjectToLoadableObjectId()
        {
            // Load an asset from the AssetDatabase
            Texture2D iconTexture = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/Icon.png");

            // Convert the Object to a LoadableObjectId
            LoadableObjectId iconId = LoadableObjectIdEditorUtility.CreateLoadableObjectId(iconTexture);

            // Now iconId can be serialized on a ScriptableObject for content directory builds
        }

        public void ConvertLoadableObjectIdToObject()
        {
            LoadableObjectId iconId = new LoadableObjectId();
            // ... (iconId would typically be loaded from serialized data)

            // Convert the LoadableObjectId back to an Object in the Editor
            Object obj = LoadableObjectIdEditorUtility.LoadableObjectIdToObject(iconId);

            if (obj is Texture2D texture)
            {
                // Use the texture in the Editor
                Debug.Log($"Loaded texture: {texture.name}");
            }
        }
    }
}
```

## Static Methods

| Method                                                                                                                                        | Description                                                                                                                                                                  |
| --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [CreateLoadableObjectId](/engine/6000.7/script-reference/unityeditor/loadableobjectideditorutility/createloadableobjectid.md)                 | Creates a [LoadableObjectId](/engine/6000.7/script-reference/unity/loading/loadableobjectid.md) from an [EntityId](/engine/6000.7/script-reference/unityengine/entityid.md). |
| [LoadableObjectIdToObject](/engine/6000.7/script-reference/unityeditor/loadableobjectideditorutility/loadableobjectidtoobject.md)             | Retrieve the [Object](/engine/6000.7/script-reference/unityengine/object.md) referenced by a LoadableObjectId.                                                               |
| [TryDeconstructLoadableObjectId](/engine/6000.7/script-reference/unityeditor/loadableobjectideditorutility/trydeconstructloadableobjectid.md) | Deconstructs a LoadableObjectId into its component parts: GUID, local file identifier, and file identifier type.                                                             |
