# LoadAllAssetsAtPath(string)

> Obtains an array of all assets at assetPath.

## Definition

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

```csharp
public static Object[] LoadAllAssetsAtPath(string assetPath)
```

### Parameters

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

### Returns

| Type                                                                | Description                                    |
| ------------------------------------------------------------------- | ---------------------------------------------- |
| [Object\[\]](/engine/6000.7/script-reference/unityengine/object.md) | Returns an array of all assets at `assetPath`. |

### Remarks

Some asset files might contain multiple sub assets (such as a Maya file which may contain multiple Meshes and GameObjects).

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

This method returns the [main Asset](/engine/6000.7/script-reference/unityeditor/assetdatabase/loadmainassetatpath.md) and all [sub Assets](/engine/6000.7/script-reference/unityeditor/assetdatabase/loadallassetrepresentationsatpath.md) at a given path, including those hidden in the Project view.

**Note**: The main asset is not guaranteed to be at index 0 in the array

Additional Resources: [AssetDatabase.LoadMainAssetAtPath](/engine/6000.7/script-reference/unityeditor/assetdatabase/loadmainassetatpath.md), [AssetDatabase.LoadAllAssetRepresentationsAtPath](/engine/6000.7/script-reference/unityeditor/assetdatabase/loadallassetrepresentationsatpath.md), [AssetDatabase.AddObjectToAsset](/engine/6000.7/script-reference/unityeditor/assetdatabase/addobjecttoasset.md), [HideFlags.HideInHierarchy](/engine/6000.7/script-reference/unityengine/hideflags/hideinhierarchy.md), [EditorUtility.UnloadUnusedAssetsImmediate](/engine/6000.7/script-reference/unityeditor/editorutility/unloadunusedassetsimmediate.md).

```csharp
using UnityEngine;
using UnityEditor;

public class Example : MonoBehaviour
{
    [MenuItem("AssetDatabase/LoadAllAssetsAtPath")]
    private static void PrintAssets()
    {
        Object[] data = AssetDatabase.LoadAllAssetsAtPath("Assets/MySpriteTexture.png");

        Debug.Log(data.Length + " Assets");

        foreach (Object o in data)
        {
            Debug.Log(o);
        }

        // outputs:
        //  5 Assets
        //  MySpriteTexture (UnityEngine.Texture2D)
        //  MyTexture_0 (UnityEngine.Sprite)
        //  MyTexture_1 (UnityEngine.Sprite)
        //  MyTexture_2 (UnityEngine.Sprite)
        //  MyTexture_3 (UnityEngine.Sprite)
    }
}
```

Additional Resources: [AssetDatabase.LoadAssetAtPath](/engine/6000.7/script-reference/unityeditor/assetdatabase/loadassetatpath.md).
