I'm writing an Editor script that takes assets from a directory path, and builds them into an asset bundle.
I want to use: BuildPipeline.BuildAssetBundle(Object main, Object [] assets, string outputPath, ...);
That means I need an array of Object[]. But how do I get the array of Object[], given an asset path that contains all the fbx that I need in bundled?
Additional Analysis:
- I can't use Editor's "Selection" API. Because, I can't control what folder is selected in the Editor window.
- This doesn't work: `Object[] objects = AssetDatabase.LoadAllAssetsAtPath("Assets/Art")` , it doesn't load the assets as GameObjects or Texture2D's if I try to cast the Object afterwards. I checked using C# code: if (objects *is GameObject), it will return false for all objects in the array. This API works differently from what I assumed. It takes the file path of an asset (ie: /character.fbx), not a folder path, and outputs all children in the fbx as GameObjects. * *