How to create assetbundle at run time?
Asked Answered
G

1

0

Is there a tool which converts 3D models to asset bundles ? or is it possible to convert them at run time ?

I am able to convert them using this Loading 3d object from external server in Unity3D . But My application allows end users to upload their own 3D models and view them in application by downloading at run time .

p.s : I am very new to unity .

Guzzle answered 18/5, 2018 at 7:51 Comment(5)
asset bundles need to be built inside unity first, and they can be any kind of asset except new scripts.Ferryboat
So , there is no way to import new 3D models during run time ?Guzzle
There could be ways to do it, but you should implement and use your own system, not asset bundles.Ferryboat
could you point me at some quick start guides ? I am new to unity and unable to hit correct words on google.Guzzle
Hi, try the github.com/KhronosGroup/UnityGLTF converter, and u can convert FBX to GLTF on the server side with node.js or something else, or only use gltf modelsWoolfolk
M
2

Is there a tool which converts 3D models to asset bundles ? or is it possible to convert them at run time ?

The short answer is no. You can't during the run-time because every Unity API to create Assetbundle is only available on the Editor for Editor plugins only.

But My application allows end users to upload their own 3D models and view them in application by downloading at run time .

If what you are trying to do is allow people to import and view fbx model into Unity then you don't need Assetbundle to do this.

You have two otipns:

1.Use the TriLib (Not free) plugin if you want to support 40+ other 3D file formats too.

2.If you can't afford a paid working plugin, make your own. This requires you build a plugin with Autodesk FBX SDK in C++ and use C# to communicate with this. Since you are a beginner, I will suggest you go with #1.

Margeret answered 18/5, 2018 at 10:59 Comment(8)
I tried the test plugin . for some 3D models it doesn't seem to properly import all textures .Guzzle
Don't worry about textures. You can do that easily from script. The only thing to care about is loading the mesh which the plugin can do. For the texture, simply instantiate the loaded mesh, attach material to it with a shader then load the texture yourself and assign it to the object.Margeret
what in case of 100's of child objects with different textures ?Guzzle
You want end users to upload their own 3D models? They provide you with the model and texture for each one then you load the model with the plugin and apply the texture to it....Nothing complicated here.Margeret
Dont i need specify which texture to be applied to each and every child object ?Guzzle
@FaiyazMdAbdul In Unity each model has textures like albedo, normal and occlusion map. If there is a model and a child object with another model, each has different textures unless it is basically the-same model duplicated then they can share the-same texture. I think this is what programmer is trying to sayActuary
my bad . I meant materials actually . I tested the demo and materials seemed to be missingGuzzle
I mentioned this in my first comment. You are responsible for creating material with the textures that usually comes with the model. Again, you create a material, attach it to the loaded mesh and then apply the texture to the material and that's it.Margeret

© 2022 - 2024 — McMap. All rights reserved.