Editor Script: Get all assets in all AssetBundles

I’m doing an editor script, where I want to iterate over all assets in all assetbundles. My approach so far has been:

	foreach( var assetBundleName in UnityEditor.AssetDatabase.GetAllAssetBundleNames() )
	{
		//GetAllAssetFromAssetBundle( assetBundleName ) <- doesn't exists as far as I know
	}

But I’m stuck on getting an assetbundle by it’s name. Is that possible?

Other approaches are also most welcome :slight_smile:

It should be said, that I’m using the AssetBundleManager in “Simulation Mode”… that’s the factor, that complicates getting the assetbundles…

Okay - it was quite easy actually:

		foreach( var assetBundleName in AssetDatabase.GetAllAssetBundleNames() )
		{
			foreach( var assetPathAndName in AssetDatabase.GetAssetPathsFromAssetBundle(assetBundleName) )
			{
				string nameWithoutPath = assetPathAndName.Substring( assetPathAndName.LastIndexOf( "/" ) + 1 );
				string name = nameWithoutPath.Substring( 0, nameWithoutPath.LastIndexOf( "." ) );
				Debug.Log( name );
			}
		}