Save objects with variables to .xml

Hello,

I cannot wrap my brain around how to do this. I have a series of objects in my game, all with user-defined variables set on them. I want to be able to save the position, parent and a bunch of other custom variables to a file so that they can be loaded into a scene at a later date. If someone could post some code or at least point me in the right direction that would be great!

Thank you.

Cool question. I hope it gets answered. I am more interested for debugging, though. Anyway, why don’t you prevent objects from being destroyed after you move to the next scene, retrieve their vars afterwards, instantiate new objects where you want them, assign them the vars and then destroy the first set of objects? It’s complicated, but it is the best I can offer you.

Google “c# serialize object” plenty of example to start from.

I’m sorry but I am pretty intermediate with unity still so something that doesn’t lay it out flat to me will just confuse me. Also I work in Java.