- Home /
Asset creator in Unity
Hi All, I'm trying to create an app which will enable users to create assets on the fly. To do this, I need to provide the user with some default assets which come packaged with the app, but then also allow them to create and save out new ones which are loaded at run time.
In order to load resources at run-time, it seems that I need to be using AssetBundles, but from what I can tell, the ability to create new AssetBundles is part of UnityEditor and not UnityEngine, and as such cannot be done without making a call to the Unity.exe -batch mode.
The other code I found that deals with creating assets is to call AssetDatabase.SaveAssets, but that seems to be an editor call as well.
Is there a way to do what I'm trying to do? Can I just load new resources off the file system once I'm compiled?
Thanks, Liron
Answer by yoyo · Apr 13, 2011 at 07:27 PM
You can't save assets from Unity in the way you want. As you've discovered, these are editor functions, not engine functions.
What you could do instead is find a way to save assets in a form for which you can write a loader. For example, if you have a .jpg image you can load it into a Texture2D. For 3D models, you could write out the vertices, edges, etc. and then construct a Mesh on the fly from the this data.
I'm working on an X3D export/import component for just this type of thing, could use some help.
No, it wouldn't work as a plugin, and I don't expect Unity would let you bundle it anyway. Though I suppose you could get your users to download the free version and create assets with it.
Answer by LKIM · Aug 22, 2011 at 05:09 PM
The way we ended up solving this is by having a default mesh which we imported into unity and then writing out the deltas for each vertex as a text file. We then load in the text file, read the deltas and apply them to each vertex.
Your answer
Follow this Question
Related Questions
How can I display an Asset Store within game? 0 Answers
Can I set an Asset as Addressable at Runtime? 0 Answers
Loading assets for a level from asset bundle 1 Answer
Addressable Assets integer Addresses? 0 Answers
Load Assetbundles all at once. 1 Answer