Next: , Up: Serialization   [Contents][Index]


15.1 Object Group Serializer

Component: ObjectGroupSerializer

Object Group Serializer allows you to save/load object children at runtime. All first-level child objects that you want to save must have a prefab in a ’Resources’ folder somewhere in your project, or Unity will throw an error when you try to load them. This can be used to save a customized vehicle or character - if you’ve set up such gameplay already, this component can save it.

Field of ObjectGroupSerializer: bool autoSaveOnPopulate

Do we want to save automatically when we gather a list of objects from the heirarchy? (recommended)

Default value: true

Field of ObjectGroupSerializer: bool autoClear

Should we clear the (local) object list automatically? Only disable this if you want to use additive saves (advanced users)

Default value: true

Recommended Field of ObjectGroupSerializer: string defaultFileName

If using ’Auto Save On Populate’ this is the file name that will be used

Default value: "default"

Available Messages

Message on ObjectGroupSerializer: Populate ()

Populates the temporary object list by recording all of it’s first-level children. If ’Auto Save On Populate’ is disabled, you need to call Save afterwards

Message on ObjectGroupSerializer: InstantiateObjectList ()

Instantiates the objects that are currently in temporary memory. Call this after Load if ’Auto Instantiate’ is disabled.

Message on ObjectGroupSerializer: Save (string)

Save the current object list from memory to disk. Only needed if ’Auto Save On Populate’ is false. You must call ’Populate’ before this message will work.

Argument: File name we want to save to

Message on ObjectGroupSerializer: Load (string)

Load object children into the local list.

Argument: File name we want to load from

Message on ObjectGroupSerializer: Clear ()

Clears the object list. This is a list stored in temporary memory that you can save to disk with ’Save’ or add objects to with ’PopulateByTag’. ’Load’ fills the list from disk

Field of ObjectGroupSerializer: bool autoSaveOnPopulate

Do we want to save automatically when we gather a list of objects from the heirarchy? (recommended)

Default value: true

Field of ObjectGroupSerializer: bool autoClear

Should we clear the (local) object list automatically? Only disable this if you want to use additive saves (advanced users)

Default value: true

Recommended Field of ObjectGroupSerializer: string defaultFileName

If using ’Auto Save On Populate’ this is the file name that will be used

Default value: "default"

Available Messages

Message on ObjectGroupSerializer: Populate ()

Populates the temporary object list by recording all of it’s first-level children. If ’Auto Save On Populate’ is disabled, you need to call Save afterwards

Message on ObjectGroupSerializer: InstantiateObjectList ()

Instantiates the objects that are currently in temporary memory. Call this after Load if ’Auto Instantiate’ is disabled.

Message on ObjectGroupSerializer: Save (string)

Save the current object list from memory to disk. Only needed if ’Auto Save On Populate’ is false. You must call ’Populate’ before this message will work.

Argument: File name we want to save to

Message on ObjectGroupSerializer: Load (string)

Load object children into the local list.

Argument: File name we want to load from

Message on ObjectGroupSerializer: Clear ()

Clears the object list. This is a list stored in temporary memory that you can save to disk with ’Save’ or add objects to with ’PopulateByTag’. ’Load’ fills the list from disk


Next: , Up: Serialization   [Contents][Index]