# GetAssetBundleDependencies(string, bool)

> Given an assetBundleName, returns the list of AssetBundles that it depends on.

## Definition

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

```csharp
public static string[] GetAssetBundleDependencies(string assetBundleName, bool recursive)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the AssetBundle for which dependencies are required.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): If false, returns only AssetBundles which are direct dependencies of the input; if true, includes all indirect dependencies of the input.

### Returns

| Type                                                               | Description                                              |
| ------------------------------------------------------------------ | -------------------------------------------------------- |
| [string\[\]](https://learn.microsoft.com/dotnet/api/system.string) | The names of all AssetBundles that the input depends on. |

### Examples

```csharp
using System.Text;
using UnityEditor;
using UnityEngine;

public class AssetDatabaseExamples : MonoBehaviour
{
    [MenuItem("AssetDatabase/Find Bundles With Dependencies")]
    static void BundleDependency()
    {
        var allBundleNames = AssetDatabase.GetAllAssetBundleNames();
        foreach (var bundle in allBundleNames)
        {
            var dependencies = AssetDatabase.GetAssetBundleDependencies(bundle, true);
            if (dependencies.Length == 0)
                continue;
            var dependencyString = new StringBuilder();
            foreach (var dependency in dependencies)
            {
                dependencyString.Append($"\"{dependency}\" ");
            }
            Debug.Log($"{bundle} depends on {dependencyString}");
        }
    }
}
```
