- Home /
Load model & animation during runtime
Hey there,
I read an incoming xml that tells the app which scene to use, model to use, wich animation, which skin/material, etc.
My problem now is that I cannot put all of these objects to be loaded into a scene and then just create a GameObject from it, as this would make memory explode ;)
I need to dynamically load a model and apply to it the correct animation during runtime. How would this be possible in Unity? In all examples, and from my testing, you already have "finished" models with an animation attached (in which you have to state which AnimationClip goes from frame x to y).
But I really need to load the model file & the animation file (those should not be combined, but each animation set in a different file) when the application is already running. And THEN create a GameObject from it.
And once the scene with those dynamically loaded objects is finished rendering, the scene must be unloaded, freeing previously loaded models, animation, etc., but I guess Unity does that automatially when you unload a scene.
Oh yes! Please let me know, if you found a solution for that. Really helpful question. :)
Answer by CoixdeNono · Feb 14, 2013 at 09:36 AM
Loading things at runtime is easily done with assetBundle, although i've never tried to do it with animations and models apart. Here Maybe you can use an Animator Controler, it does a great job adding animations to a model without having these animations ON your model. Mecanim could realy help you here .
Thanks, but you misunderstood me. I dont want to import a bundle (.unity3d). I want to dynamically import obj files, attach animations to it (from an external file) and load the texture. So I dont have bundles on my server. I want to create a new map/scene by downloading (or simply importing) objects with animations while runtime. $$anonymous$$aybe you have an idea for me, how to do this. :) thanks!