NetworkFactorySpawnMessage
Lightweight network message struct that carries spawn request data between server and clients. Used internally by NetworkPrefabHandler to synchronize factory spawn operations across the network.
Definition
Namespace: Paragon.Core.Network
Assembly: Paragon.dll
public struct NetworkFactorySpawnMessage : INetworkSerializableImplements: Unity.Netcode.INetworkSerializable
Remarks
NetworkFactorySpawnMessage is the wire format for factory spawn requests. When the server calls NetworkSpawn() on a network factory, a NetworkPrefabHandler internally sends this message to synchronize the spawn across clients. The message contains the minimum data needed to replicate the spawn:
Who owns the spawned object (
OwnerClientID)How it should be spawned — server-authoritative or predicted (
Predicted)What variant or data index to use (
ID)
This is a value type (struct) for zero-allocation messaging. The INetworkSerializable implementation serializes all three fields in a fixed order.
Quick Lookup
Create a spawn message
new NetworkFactorySpawnMessage(ownerClientId, predicted, id)
Read the owner
message.OwnerClientID
Check if predicted
message.Predicted
Get the data/variant ID
message.ID
Properties
OwnerClientID
The Netcode client ID that will own the spawned NetworkObject.
Predicted
Whether this spawn should use client-side prediction.
ID
An integer identifier for the spawn — typically a variant index or data lookup key used by the NetworkPrefabHandler to determine which data/variant to apply.
Constructor
ownerClientId
ulong
Netcode client ID for ownership assignment
predicted
bool
Whether to use predicted spawning
id
int
Variant/data identifier
Methods
NetworkSerialize<T>
Serializes or deserializes the message fields for network transmission.
Serialization order:
ownerClientId(ulong)predicted(bool)id(int)
Common Pitfalls
Struct default values
As a struct, the default constructor produces OwnerClientID = 0, Predicted = false, ID = 0. Ensure all fields are explicitly set when constructing a message.
Internal usage only
This message is sent and received by NetworkPrefabHandler internally. Game code should not typically need to construct or send this message directly — use NetworkScriptableFactory.NetworkSpawn() instead.
See Also
NetworkScriptableFactory<TObject> — factory that triggers spawn messages
NetworkScriptableFactory<TObject, TData> — data-aware factory with variant spawning
Network Factory — system overview
Last updated