Jump to content

Serialization


photo

Recommended Posts

Hello,

 

I have a purely Unigine-script defined object the consists of other Unigine-script defined objects. I would like to serialize them, and save for loading later.

I see that you can save the entire world state, can you save objects selectively?

 

1) How do I serialize an object and its contents to a specified file?

 

2) If I load the serialized object twice, will they still be valid?

For example: object A has a reference to objects B and C. If I serialize A (which serializes its components B and C), when I load this twice, will it be valid?

Load1: A1 has B1 and C1

Load 2: A2 has B2 and C2.

Link to comment

We have been cheating by using the NodeDummy Unigine class and the Property class to store data. That way we can save all our information into existing .node files or directly in the .world file.

Link to comment

If it were a node, you could have used saveState/restoreState, but as for Unigine-script defined objects, they are not serialized automatically, so you need to create your own serializer. Or give a try to the method Danni suggested.

Link to comment
×
×
  • Create New...