Next: Unique Object Serializer, Previous: Object Group Serializer, Up: Serialization [Contents][Index]
Scene Object List Serializer allows the player to save the contents of a scene. It saves position, rotation, scale, and material list. The objects you are loading, and their materials, must be directly inside a folder called ’Resources’ anywhere in your project, or Unity will not have access to the data.
To use, add a tag to your game for objects that you want to save. Then, at save time, call ’PopulateByTag’ for each tag of objects you want to save. If saving more than one tag, disable ’Auto Save On Populate’ and call ’Save’ after all tags are added. To load, first call ’Clear’ to clear the temporary object list then ’ClearObjectsByTag’ for each tag you wish to load to remove the physical objects from the scene, then call ’Load’ to get the old temporary object list from disk and put it into memory, if ’Auto Instantiate’ is disabled, call ’InstantiateObjectList’ when done loading tags.
bool
autoInstantiateDo we want to automatically instantiate the objects when we load?
Default value: true
bool
autoSaveOnPopulateDo we want to save automatically when we gather a list of objects from the scene? (recommended)
Default value: true
bool
localBackupWhen saving to URL, should we save the file locally as well?
Default value: false
List<SceneObject>
objectsThe list of local objects stored in memory. Shown here for debugging purposes, calling ’Save’ will write this object list to disk, and ’Load’ will get the object from disk and ADD it to the current list. ’Clear’ can be used to clear the list and start again.
Default value: new List<SceneObject>()
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’
Adds objects currently in the scene, defined by the tag supplied as a parameter, to the object list for saving. Call this multiple times to add multiple sets of objects to the list, but only if you’ve disabled ’Auto Save On Populate’ in which cas you need to call ’Save’ when you’re done.
Argument: The tag representing objects we want to add to the list for saving to disk.
Saves the current object list to disk. Make sure to call ’PopulateByTag’ before calling this, otherwise the list may be empty.
Deletes all objects with a supplied tag from the scene. Be sure to do this before loading objects or you will get duplicates.
Argument: A Tag representing the scene objects you want to delete. Usually this is the same as the tag for objects you are loading. To clear multiple tags, call this multiple times (try using a ’Message Relay’).
Attempts to load the current level from disk. If ’Auto Instantiate’ is enabled, this will also cause the objects to be instantiated after loading.
Instantiates the current object list into the game. Useful if not using ’Auto Instantiate’ but be sure to call ’ClearObjectsByTag’ first, to get rid of the old ones.
Assigns an optional unique name to this file. Change this to save/load a separate save file for the same scene.
Argument: Name of the unique save file identifier for this file.
Saves the current object list to a web server. You will need some server-side code to handle this (Node.js recommended)
Argument: The URL for the POST request.
Loads a new object list from a web server. You will need some server-side code to handle this (Node.js recommended)
Argument: The URL for the GET request.
Assigns a username, must be called before saving/loading to a URL
Argument: The new user name for the web request
bool
autoInstantiateDo we want to automatically instantiate the objects when we load?
Default value: true
bool
autoSaveOnPopulateDo we want to save automatically when we gather a list of objects from the scene? (recommended)
Default value: true
bool
localBackupWhen saving to URL, should we save the file locally as well?
Default value: false
List<SceneObject>
objectsThe list of local objects stored in memory. Shown here for debugging purposes, calling ’Save’ will write this object list to disk, and ’Load’ will get the object from disk and ADD it to the current list. ’Clear’ can be used to clear the list and start again.
Default value: new List<SceneObject>()
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’
Adds objects currently in the scene, defined by the tag supplied as a parameter, to the object list for saving. Call this multiple times to add multiple sets of objects to the list, but only if you’ve disabled ’Auto Save On Populate’ in which cas you need to call ’Save’ when you’re done.
Argument: The tag representing objects we want to add to the list for saving to disk.
Saves the current object list to disk. Make sure to call ’PopulateByTag’ before calling this, otherwise the list may be empty.
Deletes all objects with a supplied tag from the scene. Be sure to do this before loading objects or you will get duplicates.
Argument: A Tag representing the scene objects you want to delete. Usually this is the same as the tag for objects you are loading. To clear multiple tags, call this multiple times (try using a ’Message Relay’).
Attempts to load the current level from disk. If ’Auto Instantiate’ is enabled, this will also cause the objects to be instantiated after loading.
Instantiates the current object list into the game. Useful if not using ’Auto Instantiate’ but be sure to call ’ClearObjectsByTag’ first, to get rid of the old ones.
Assigns an optional unique name to this file. Change this to save/load a separate save file for the same scene.
Argument: Name of the unique save file identifier for this file.
Saves the current object list to a web server. You will need some server-side code to handle this (Node.js recommended)
Argument: The URL for the POST request.
Loads a new object list from a web server. You will need some server-side code to handle this (Node.js recommended)
Argument: The URL for the GET request.
Assigns a username, must be called before saving/loading to a URL
Argument: The new user name for the web request
Next: Unique Object Serializer, Previous: Object Group Serializer, Up: Serialization [Contents][Index]