I am building a tool for our workflow and I need to know for each string returned by AssetDatabase.GetAllAssetBundleNames() if there is a variant part in it or not.
I have read the online documentation again and again but did not find any way to do it except after building the assets and having a reference to the manifest. I need to do it before building the bundles.
Is there any hidden method to do that? Using UnityEditorInternal maybe?
Hi Tourist,
Are you looking for this information ?
At any time you can get the assetimporter information using AssetImporter.GetAtPath() method and then read the assetbundleVariant value in it.
This works for me (Unity 5.5.3):
var m1 = typeof(AssetDatabase).GetMethod("GetAllAssetBundleNamesWithoutVariant", BindingFlags.Static | BindingFlags.NonPublic);
var bundles = (string[])m1.Invoke(null, null);
var m2 = typeof(AssetDatabase).GetMethod("GetAllAssetBundleVariants", BindingFlags.Static | BindingFlags.NonPublic);
var variants = (string[])m2.Invoke(null, null);