- Home /
Editor : dynamic asset creation and prefabs, best practice ?
Hello,
I am creating an editor extension (a voxel editor for creating models).
There is a lot of dynamic assets creation involved (texture, mesh, material, data)
I've managed to overcome most of the problems working with the editor using a lot of googling, and it is basically working, but I don't know if I handle asset creation the right way.
Model creation :
- create data asset (scriptable object stored in a .asset file)
- create mesh asset (mesh object stored in a .asset file)
- create texture asset (texture .png)
- create material asset (material .mat)
Start editing model :
- duplicate existing data asset (new .asset file)
- duplicate existing mesh asset (new .asset file)
- duplicate existing texture asset (new .png file)
- duplicate existing material asset (new .mat file)
Now, I guess you are asking : why duplicate assets every time ?
If the user creates a prefab with the voxel model, and edit an instance of the prefab, we need separate data or all prefab instances will be updated, even if the user never click "Apply".
Of course because of that, every time we start editing a model a lot of slow IO takes place. Also a lot of unused asset files might be generated.
Is there a better way to handle dynamic asset file creation / prefab generation ?
I know prefab need physical asset files to retain the link when the prefab is created, but gameobjects do not. Is there a way to generate the files only when the prefab is created by the user ?
Thanks a lot for your time
I'm not sure this is the right place. This sounds more like something that can be discussed in the forum. I'm also doing dynamic mesh generation and would love to discuss this, but I feel this is not the right format here. Would you $$anonymous$$d moving this to the forums and linking to the thread here?
ok, reposted in the scripting forum http://forum.unity3d.com/threads/221263-Editor-dynamic-asset-creation-and-prefabs-best-practice?p=1475464#post1475464
Answer by joelfivat · Jan 14, 2014 at 03:06 PM
I have my answer : my voxel data should not be considered as a an attribute of the prefab but as the model as a whole. Instead, I will provide a "Clone" button to duplicate all the model assets.