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 : INetworkSerializable

Implements: 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

Goal
How

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

Parameter
Type
Description

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:

  1. ownerClientId (ulong)

  2. predicted (bool)

  3. id (int)

Common Pitfalls

circle-exclamation
circle-exclamation

See Also

  • NetworkScriptableFactory<TObject> — factory that triggers spawn messages

  • NetworkScriptableFactory<TObject, TData> — data-aware factory with variant spawning

  • Network Factory — system overview

Last updated