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.
- Listed in Networking and servers
Fields
18 private and internal fields
| Member | What it is |
|---|---|
private static Chunk chunk | The chunk the entity is in. |
private static uint embeddedCount | Number of embedded entities. |
private static NetworkEntity entity | The entity being spawned. |
private static uint entityIdentifier | The entity's identifier. |
private static uint entitySpawnIndex | Spawn index, used to ignore destroy messages for an older spawn. |
private static bool isSendingScale | Whether a scale is sent. |
private static bool isSendingTransform | Whether position and rotation are sent. |
private static float lastTime | Unused. |
private static Logger logger | NLog logger; logs which prefab failed when spawning throws. |
private const float MaximumScale | Largest scale that can be sent (10.23). |
private static Vector3 position | Position sent with the chunk. |
private static uint prefabHash | The prefab hash (sent in 16 bits). |
private static int readCount | Unused. |
private static Quaternion rotation | Rotation, compressed. |
private static float scale | Uniform scale. |
private const int ScaleBits | Bits used for scale (10). |
private static TransformSave transformSet | Reused transform passed to the spawner. |
private static int writeCount | Unused. |
Methods
| Member | What 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. |