Save created child object to empty GameObject in GameBuild ( Not Editor ) - Save to XML?
Ok Guys. What I am trying to do is let the player build a ship with blocks. Got that working ok. The Scene has a EMPTY GameObject called "SHIP" that when you build cubes it adds it to the SHIP as child. So SHIP is always the parent. In edit It work using PrefabUtility.ReplacePrefab in script. Saving to a prefab and then loading it in the next game scene as the body of the player ship.
The Problem. Game Build fails cause I can't use PrefabUtility.ReplacePrefab in script. How can I save one GameObject and it Children objects to xml file. Then Load that XML file to instantiate the object as the ships body.
All the serialization examples I have came across save the scene.
Than you for your Time!
How the Ship create scene looks.
Answer by Dark_Seth · Oct 30, 2015 at 09:02 PM
Ok.got it done. cubes gets rebuild via using position. Cube Id and material id. Player can build ship.it saves and then used in game
HI @Dark_Seth , could you please elaborate on how you saved the data. I have a similar usecase a i have successfully saved position, scale and material of a gameobject. But my parent object is very complex that i need to maintain hierarchy in it as well. Please help me out in maintaining this hierarchy while saving data
Your answer
Follow this Question
Related Questions
Serialize gameobject children behaviours 0 Answers
transform.childCount not working as intended 0 Answers
How can i make a prefab character to be a child of an existing game object after purchasing 1 Answer
ChildsParentObject Function 0 Answers
How can I move a gameobjects box Collider with another asset? 0 Answers