I am a Unity beginner who is currently working on a small Unity project in which I will need to dynamically load .fbx files during runtime. I.e. I want to build a Windows Unity application in which the user can supply a .fbx file as a command line argument (or similar) which will then be shown in the scene.
Is this possible at all? I did some searching and it seems I could use the Pro feature Asset Bundles for this, is this correct? Are there any other options available? If there are ways in which the fbx file must be converted or built in any way before passing it to the built Unity app that would works as well, as long as it is very easy for the end user to do so. Preferably, I do not want to require that the user has a Unity installation, just the built Unity app and a collection of fbx files.
No, you can’t use assetbundles for that because that would require the user to have a unity pro install.
You do not have a lot of options. If you have unity pro, then you could use the autodesk fbx sdk(you would need to write a c# managed wrapper for it most likely), but if you only have unity free(which is more likely because you are a beginner) you will either need to find a managed library for loading fbx, or write your own fbx loader which will not be easy.
Thanks for the reply! That’s a bummer… I do not have the Pro version at the moment, but if it will be necessary for the project I might be able to get it. I have thought about getting it in the past and if it is needed now might be a good time.
I did find a few plugins that might be of use, for example these two:
Perhaps Unity Pro and one of those is the way to go if I cannot find any way to do it in the free version of Unity.
If you absolutely need FBX then yeah, like Zerot says, but is there a way you can do it with OBJ? There are a few inexpensive dynamic OBJ loaders that might work for you.
OBJ might actually work, but when importing the same object into Unity saved as both FBX and OBJ+MTL, FBX has worked a lot better for me, I’m having some issues with getting the MTL files to load. However there are probably a lot of things I could tweak to make OBJ work better. Ony, would you recommend any particular OBJ loaders?
Also, what if I remove the constraint of having no Unity Editor installs on the end user’s system? Would it be possible to, for example, create a script that loads my Unity project, imports a user specified FBX file, then builds and runs the project? The important thing would be that the process is automated since I cannot assume that the end users have any Unity experience.
Thanks, I will do that. Still, I would like to explore some other options, for example creating some kind of script that loads a FBX file into unity, builds the project and then runs it. This application/game will not be publicly distributed so that would work OK as well, even though I would prefer not having to rely on a Unity installation on the end user’s system.