www class, save and load prefabs

Hello, I’m trying to do the following:
I want to create a prefab at runtime, save it in a server (or wherever I want) and then when the user restart the executable I want to load this prefab. The idea is something similar to the sims: the user creates a home (walls, doors, windows…),the user saves the whole house as a prefab (in a server) and the next time the user can load the home prefab.

I have found that the class can read textures www, xml, etc. … but I have not found exactly how to read an object, in this case a prefab. I’ve seen the assetBundle but for that you need a .unity3D.

All this considering that you want to do this using Unity Web.

Does anyone have any idea?

The only idea that i have is to save in a file the name of individuals prefabs and their positions… but save a prefab and load it, would be great!

Thanks in advance.

Prefabs in Unity are for the time being just an Unity editor feature. Prefabs are predefined assets which can only be created in the editor. Prefabs doesn’t even exist in your build. A prefab at runtime is just an off-scene gameobject. It is loaded like any other asset and can be used as clone (Instantiate) source.

Unity has no inbuild functions to save any kind of gamestate. This has to be implemented by yourself. I guess there are third party frameworks out there for Unity which allows some kind of saving and loading.

If you don’t have the money to buy such a package you can still do it yourself. It’s up to you how you save the data. Very common is using some kind of xml structure to save everything (Mesh data, object parameters, name, position / rotation / scale, components, …) in a text format. For images it’s best to use png files.

I’m pretty sure you can’t create prefabs (easily) at runtime. How this type of thing has been done is you serialize your objects to some format of your choosing, then reconstruct objects when you parse them back in. I use X3D personally as it’s pretty robust, but others use OBJ or roll-your-own json or xml.