I’m making an app separated in 2 parts.
The first part is a VR configurator that modify the children’s material of a Prefab at the runtime.
Each child has a specific material that the configurator modifies.
The second part is a WebGL Viewer that will allow to load a saved configuration to view it and manipulate it.
My question is : What is the best way to locally save the prefab with all its children (plus the materials) and then to load it on the viewer ?
I am not sure if there’s any built-in solution for that. You could write that yourself, though. Whatever changes you apply to the materials / prefabs in the editor, you need to reapply when loading the file in the viewer. Just save those changes in some way to a file, then load and apply them in the viewer.
The closest unity comes to this is JsonUtility, it lets you write and read any unity serializable objects into a JSON, which is a specially formatted string. The only issue is that this doesn’t support references to assets (because there’s no way how to obtain a reference to an asset from asset database (project view) in unity).