Skip to main content

SavedDynamicObject

A class in Root.Township, Alta.Chunks.

One saved entity (with its child entities) as a prefab hash plus a packed bit stream. Chunk saves are lists of these, and StringVersion is the text form used by select tostring and spawn strings.

Constructors​

MemberWhat it is
SavedDynamicObject(uint[] savingData, uint sizeInBytes, uint prefabHash)Creates a SavedDynamicObject from savingData, sizeInBytes and prefabHash.
SavedDynamicObject(List<uint[]> savingData, uint sizeInBytes, uint prefabHash)Creates a SavedDynamicObject from savingData, sizeInBytes and prefabHash.

Fields​

MemberWhat it is
protected List<uint[]> dataBacking list for Data.
protected uint hashBacking field for Hash.
protected uint messageSizeInBytesBacking field for MessageSizeInBytes.
2 private and internal fields
MemberWhat it is
private static Logger loggerNLog logger for this class.
private static UnclearedPower2ArrayPool<uint> poolShared uint array pool the saved data arrays come from.

Properties​

MemberWhat it is
List<uint[]> Data { get; }The packed save data, in pooled 512-word buffers.
uint Hash { get; }Prefab hash of the saved entity.
uint MessageSizeInBytes { get; }Size of the saved data in bytes.
uint MessageSizeInWords { get; }Size of the saved data in 32-bit words, rounded up.

Methods​

MemberWhat it is
void Dispose()Returns the data buffers to the pool.
static SavedDynamicObject GetPositionlessSaveOf(NetworkEntity entity)Saves an entity and its children without its position.
static SavedDynamicObject GetSaveOf(NetworkEntity entity)Saves an entity and its children in the latest save format.
virtual ChunkVersioning GetVersion()Save format versions of the data. The latest by default.
static StreamWriter GetWriter(out List<uint[]> data)Makes a stream writer that collects its output into pooled buffers.
NetworkEntity Spawn(ChunkVersioning chunkVersioning)Spawns the prefab and loads the saved data into it, without initializing. Null if the prefab doesn't exist.
NetworkEntity SpawnOwned(ChunkVersioning chunkVersioning)Spawns, runs load setup and initializes the entity and its children on the server.
virtual string StringVersion()Text form: hash, size, the data words, then | and the format versions.

Used in​

Members of other types that take, return or hold a SavedDynamicObject: