Can AssetDatabase.LoadAllAssetsAtPath Load All Assets Recursively?

I'm confused by the documentation for LoadAllAssetsAtPath. It reads:

*Returns an array of all asset objects at assetPath.

Some asset files may contain multiple objects (such as a Maya file which may contain multiple Meshes and GameObjects). All paths are relative to the project folder. Like: "Assets/MyTextures/hello.png"*

I know some assets contain multiple objects. Would a path such as:

"Assets/BunchOfStuff/"

load all the assets under BunchOfStuff recursively? It doesn't appear so. When I call:

AssetDatabase.LoadAllAssetsAtPath("Assets/SomeDirectory");

As a path that contains child assets, I get two Objects returned. It doesn't matter if there are more assets under that part or no assets at all. Always 2 are returned. I'm not sure what they are.

I'm trying to script an automated build for a bunch of asset bundles containing a large amount of content (text and images). I don't want to have to enumerate all the assets I want included in the case where every asset should be included. I've seen the simplified example scripts but I've not seen any yet that handle a bunch of assets.

You can just list all files usung file listing and load them one by one:

string[] aMaterialFiles = Directory.GetFiles(Application.dataPath, "*.mat", SearchOption.AllDirectories);
foreach(string matFile in aMaterialFiles)
{
	string assetPath = "Assets" + matFile.Replace(Application.dataPath, "").Replace('\\', '/');
	Material sourceMat = (Material)AssetDatabase.LoadAssetAtPath(assetPath, typeof(Material));
			// .. do whatever you like
}

AssetDatabase.LoadAllAssetsAtPath() only works if you specify the path of a single object. It will load all the assets that are children of that asset.

It sounds like you want to use Resources.LoadAll(path), which will load all the assets at the specified relative path inside any folder named “Resources” (you might have to rename/rearrange your project hierarchy)