Skip to main content

SpawnMessage

A static class in Root.Township, Alta.Networking.

The network message that spawns a prefab on clients: prefab hash, entity and embedded ids, spawn index, and optionally chunk, position, rotation and scale.

Fields​

18 private and internal fields
MemberWhat it is
private static Chunk chunkThe chunk the entity is in.
private static uint embeddedCountNumber of embedded entities.
private static NetworkEntity entityThe entity being spawned.
private static uint entityIdentifierThe entity's identifier.
private static uint entitySpawnIndexSpawn index, used to ignore destroy messages for an older spawn.
private static bool isSendingScaleWhether a scale is sent.
private static bool isSendingTransformWhether position and rotation are sent.
private static float lastTimeUnused.
private static Logger loggerNLog logger; logs which prefab failed when spawning throws.
private const float MaximumScaleLargest scale that can be sent (10.23).
private static Vector3 positionPosition sent with the chunk.
private static uint prefabHashThe prefab hash (sent in 16 bits).
private static int readCountUnused.
private static Quaternion rotationRotation, compressed.
private static float scaleUniform scale.
private const int ScaleBitsBits used for scale (10).
private static TransformSave transformSetReused transform passed to the spawner.
private static int writeCountUnused.

Methods​

MemberWhat it is
static void Serialize(Connection connection, Stream stream)Writes or reads the spawn data; on read spawns the prefab through the scene spawner and updates its spawn index.
static void Set(NetworkPrefab prefab)Server: fills the message from a spawned prefab; transform only if it syncs position, scale only if not 1.