0

I have A directory in the dataPersistentPath, the name of directory is "FBXFiles". so the access is: Path.Combine(Application.persistentDataPath, "FBXFiles");

I want to load all of the files in this directory as GameObjects (or UnityEngine.Object) One more thing, this application is for hololens, so I can't use the UnityEditor namespace...

How can I do that? I've tried with assetBundle but no luck...how can I do it at runtime...?

3 Answers 3

1

Unity does not support importing objects as game objects at runtime, since it optimizes them and converts them to game ready assets at build time and in the editor. You can try including a library to load these objects, maybe as something open source like OBJ and create new game objects with materials but I am not sure this will work. Or use asset bundles, but generally System.IO and asset bundles are a bad move. Unity has built in functions for accessing asset bundles.
Best of luck.

Sign up to request clarification or add additional context in comments.

3 Comments

Yeah but how...? Can i create assetbundle and add files into it at runtime?
You can try this: answers.unity.com/questions/10868/…. They are making their own asset bundles.
OK looks good... I'll try if I won't find another solution (maybe I'll upload asset bundle files that I'll create with unity and that's it)
1

You can't do this

FBX files are assets that require importing and conversion to Unity's (internal) format. You need to use Asset Bundles.

2 Comments

But how should i use the assetbundles? I want to download fbx files to this directory but not to build again...
I haven't used asset bundles yet myself, but "downloading to a directory and not building again" is exactly what they're for.
0

You can use asset bundles.

1- Create prefabs of the fbx models

2- Put the prefabs in asset bundle

3- Download the asset bundle

4- Instantiate the prefabs at runtime.

And do give the Unity Asset Bundle Browser tool a try:

https://docs.unity3d.com/Manual/AssetBundles-Browser.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.