SerializedSavedDynamicObject
A class in Root.Township, the global namespace.
A saved object (prefab hash plus its serialized state) in a form Unity can serialize, with the chunk versioning it was saved under. Used for postboxes, set pieces and spawn strings.
- Listed in Global namespace: S
- Inherits or implements
SavedDynamicObject
Constructors
| Member | What it is |
|---|---|
SerializedSavedDynamicObject(List<uint[]> savingData, uint sizeBytes, uint prefabHash, ChunkVersioning chunkVersioning = null) | Creates a SerializedSavedDynamicObject from savingData, sizeBytes, prefabHash and chunkVersioning. |
Fields
4 private and internal fields
Properties
| Member | What it is |
|---|---|
ChunkVersioning Versioning { get; private set; } | The chunk versioning the data was saved under. Defaults to the latest. |
Methods
| Member | What it is |
|---|---|
static SerializedSavedDynamicObject GetFromString(string value) | Parses a spawn string: comma separated numbers (prefab hash, byte size, data) with optional versioning after a |. |
static SerializedSavedDynamicObject GetSaveOf(NetworkPrefab prefab) | Saves a prefab's current state under the latest versioning. |
override ChunkVersioning GetVersion() | The chunk versioning the data was saved under. |
void Initialize() | Rebuilds the working data and versioning after Unity deserialization. Safe to call more than once. |
NetworkEntity Load(Transform parent, Vector3 localPosition, Quaternion localRotation, Chunk chunk, SaveMode saveMode) | Obsolete: spawns the object and loads into it, but spawns network entities twice. Use LoadInto. |
void LoadInto(NetworkEntity existing, SaveMode saveMode) | Server: loads the saved state into an existing entity, initializes it and sets its save mode. |
void LoadIntoPrefablessEntity(NetworkEntity entity) | Loads saved state into an entity that has no prefab, such as a scene object. |
static SerializedSavedDynamicObject SaveFromPrefablessEntity(NetworkEntity entity) | Saves an entity that has no prefab, with a prefab hash of 0. |
static NetworkEntity SpawnFromString(string value, SaveMode saveMode) | Spawns an object from a spawn string. Returns null and logs on failure. Used by spawn string and trade commands. |
2 private and internal methods
| Member | What it is |
|---|---|
private void Load(NetworkEntity existing, Transform parent, Vector3 localPosition, Quaternion localRotation, SaveMode saveMode) | Obsolete: spawns the object and loads into it, but spawns network entities twice. Use LoadInto. |
private NetworkEntity Spawn() | Spawns a fresh entity of the saved prefab hash through the spawn manager. Used by the obsolete Load. |
Used in
Members of other types that take, return or hold a SerializedSavedDynamicObject: