Add assets from database?

Is it possible to add a new asset, say an obj file, from a database while the unity program is running? I’m wondering if I can load assets on demand within the program without having each asset already loaded into executable. The idea is that I want to keep all the data in the database so I can make a bare-bones executable instead of re-exporting every time I want to add an asset. Is that possible?

theoretically it is possible, but quite a lot of work.

you can start with this script, it worked for me, but I only tried it in a test setup, maybe you have to make some adjustments :

You can use it to save your objects and store the location (or the data) in a DB. Textures can be handled by downloading them with the WWW class, and applying them to the Material of your object.

I have no idea if scripts can be loaded and applied dynamically, but usually scripts do not contribute much to the filesize. I’m sure there will even be a way to do this.

But it will be a lot of work and there are limits. You essentially have to do runtime assembly of all your assets (or at least of those you want to download), and preferably keep track of them. And depending on the kind of project you are doing, a lot of complexity regarding setup might creep in. And you always will have to include some stuff you cannot store remotely or load during runtime.

It is a nice idea, though. I have been thinking about this as well, just havent found the time yet to try a full test. It could make updates to your project fairly smooth and powerfull.

thanks for the reply! i looked into the MeshSerializer and that is exactly what i needed. i actually did some playing around and i was able to save the exported mesh to my database and pull it back in via the WWW class. pretty awesome stuff.

the next step for me is trying to get all the scripts and everything applied to the mesh once it’s loaded. like you said, there’s no doubt going to be some heavy coding. i probably just need to search some more through the documentation, but is it fairly easy to add a script? i know there’s classes for Materials and stuff like that, but is there easy syntax for adding a script to an object by name? i was wondering if there’s a type associated with all scripts so i could possible traverse through the scripts to find the one i needed in the future. it seems like that should definitely be possible, i just need to dive into the documentation some more.

This will not work if you need animation as there is no API for getting animation into the engine. You could ofc script it yourself.

This is what you’re looking for to add scripts:

d.