I have a lot of prefabs which I want to export as separate assetbundles when selected in editor, so one bundle for each selected prefab.
The prefabs all share textures which I export before in another separate bundle.
Here´s my code which has an error:
static void Export() {
BuildAssetBundleOptions options = BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets | BuildAssetBundleOptions.DeterministicAssetBundle;
BuildPipeline.PushAssetDependencies();
BuildPipeline.BuildAssetBundle(AssetDatabase.LoadMainAssetAtPath("Assets/99_PREFABS/textures.prefab"), null, "AssetBundles/textures.unity3d", options, BuildTarget.iPhone);
Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
foreach(object g in selection) {
BuildPipeline.PushAssetDependencies();
BuildPipeline.BuildAssetBundle(g, selection, "AssetBundles/" + g.ToString() + ".unity3d", options, BuildTarget.iPhone);
Selection.objects = selection;
BuildPipeline.PopAssetDependencies();
}
BuildPipeline.PopAssetDependencies();
}
There´s an error in line 12:
The best overloaded method match for `UnityEditor.BuildPipeline.BuildAssetBundle(UnityEngine.Object, UnityEngine.Object[ ], string, UnityEditor.BuildAssetBundleOptions, UnityEditor.BuildTarget)’ has some invalid arguments
Why?