For a schoolproject we're working on a project for loading BIM-models into unity. We are working with .ifc files, which we convert to .dae for the time being. We created a script for importing the files using EditorUtility.OpenFilePanel. We are using IFCOpenshell's IFCConvert (a command line utility).
This goes well, and the Asset shows up in the Assets folder. The only thing left to do now, is importing the asset runtime into the Hierarchy *without dragging it into the scene or hierarchy *.
We've tried to use a WWW stream to get the file and assign AssetBundles to it and a few other methods, but no luck yet.
"The only thing left to do now, is importing the asset runtime into the Hierarchy"
Unless I misunderstand you: for items in "Project" (ie, your assets), if you want to put them in the current scene .. drag them in to the scene.
(ie, drag them either in to the Heirarchy panel or just literally in to the middle of the scene Editor.)
Are you saying you're trying to automate this ?? (I don't really see how you could - any button you added would be more difficult than .. just dragging them in.)
If you are simply asking how to load (at runtime) Resources, just look in to
Resources.LoadAll()
You'll learn that you have to keep the items in a "Resources/" folder and so on. It is well documented. There are 1000s of QA on the topic. Example code fragment
ra = Resources.LoadAll("VO/", typeof(AudioClip) ).Cast<AudioClip>().ToArray();
It is beyond the scope of a QA site to provide a tutorial on "Resources" but you can instantly find this on Unity3d.com.
Note that if, very simply, you just want to use a particular model in the build. Do nothing more than, drag it to the scene and place it where you want. Then in code just
public GameObject yourBuilding;
and use inspector-dragging to link that variable as you wish. Then you can use that variable as you wish. Note that for large complicated models, often you will go ahead and just have different inspector variables for the different parts, rather than even bothering to drill-down. (So, you might have "hospital", "eastWing" "corridor" .. etc. and just go ahead and "inspector-drag" those.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With