# IsMainAssetAtPathLoaded(string)

> Checks whether the main asset object at assetPath is loaded in memory.

## Definition

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

```csharp
public static bool IsMainAssetAtPathLoaded(string assetPath)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Filesystem path of the asset to load.

### Returns

| Type                                                          | Description                                                               |
| ------------------------------------------------------------- | ------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns true if the main asset object at `assetPath` is loaded in memory. |

### Remarks

All paths are relative to the Project folder, for example: "Assets/MyTextures/hello.png".

Additional Resources: [AssetDatabase.LoadMainAssetAtPath](/engine/6000.3/script-reference/unityeditor/assetdatabase/loadmainassetatpath.md), [Resources.UnloadAsset](/engine/6000.3/script-reference/unityengine/resources/unloadasset.md), [EditorUtility.UnloadUnusedAssetsImmediate](/engine/6000.3/script-reference/unityeditor/editorutility/unloadunusedassetsimmediate.md).

### Examples

```csharp
using UnityEditor;
using UnityEngine;

public class AssetDatabaseExamples : MonoBehaviour
{
    [MenuItem("AssetDatabase/Is Main Asset At Path Loaded")]
    static void IsMainAssetAtPathLoadedExample()
    {
        //Create a material and unload it
        var materialPath = "Assets/Materials/NewMat0.mat";
        var material = new Material(Shader.Find("Standard"));
        AssetDatabase.CreateAsset(material, materialPath);
        Resources.UnloadAsset(material);

        //This will be false
        Debug.Log(AssetDatabase.IsMainAssetAtPathLoaded(materialPath));
        //Load material into memory
        AssetDatabase.LoadAssetAtPath(materialPath, typeof(Object));
        //This will be true
        Debug.Log(AssetDatabase.IsMainAssetAtPathLoaded(materialPath));
    }
}
```
