Interface ISerializableGameObject
Implement this interface with any MonoBehaviour-derived class that can save/load state. Classes implementing this interface must also register/deregister themselves to SerializableStateManager. Only registered objects will be serialized/deserialized. If a deserialized object of the specified LoadID cannot be found then that object will not have any state restored.
Namespace: DaggerfallWorkshop.Game.Serialization
Assembly: Assembly-CSharp.dll
Syntax
public interface ISerializableGameObject
Properties
| Improve this Doc View SourceLoadID
ID used to match serialized objects to runtime objects. Must be unique for its data type and always reference the same object when procedural scene is recreated. Object will not be serialized if left at default value of 0 or if LoadID collision detected. Some objects are unique and can set LoadID to 1 or other unique value. Serialization class may not have enough information by itself to generate LoadID. e.g. It may be necessary for scene builder to create a unique LoadID during procedural layout.
Declaration
ulong LoadID { get; }
Property Value
Type | Description |
---|---|
UInt64 |
ShouldSave
Return true if object should be saved. Can return false if object is equivalent to a new instance. e.g. Only save doors which are unlocked or open, no need to save every single door.
Declaration
bool ShouldSave { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceGetSaveData()
Get object state data to serialize.
Declaration
object GetSaveData()
Returns
Type | Description |
---|---|
Object |
RestoreSaveData(Object)
Restore object state from serialized data onto a fresh procedural layout. It will usually be necessary to adjust runtime state to match saved state. e.g. Open doors must be set open, dead enemies must be despawned.
Declaration
void RestoreSaveData(object dataIn)
Parameters
Type | Name | Description |
---|---|---|
Object | dataIn |