|
I'm trying to save all data of a game(like when you save a game) but for this game you need to save a gameobject to a prefab using a script to do it. And the other thing is to save data of the variables. if some one can help me please.:)
(comments are locked)
|
|
In the Unity runtime (so outside the editor) you can't dynamically generate new prefabs (you need UnityEditor classes for that). GameObjects and their script data are serialisable so you could serialise their state using a script that enumerates over all gameobjects in a scene. To help you started on serialising gameobjects take a look at: http://www.unifycommunity.com/wiki/index.php?title=Save_and_Load_from_XML
(comments are locked)
|

Could you be more clear about your question? Are you asking how to save a GameObject as a prefab, or how to save a game's progress while the user is playing the game?
yes, save a gameobject as a prefab