Factory

The Network Factory subsystem extends the Scriptable Factory system with multiplayer support via Unity Netcode for GameObjects. It provides network-aware factory interfaces and implementations that handle NetworkObject spawning, ownership assignment, predicted spawning, and custom prefab instantiation through Netcode's INetworkPrefabInstanceHandler.

Architecture

spinner

Key Concepts

Concept
Description

INetworkScriptableFactory

Base network factory interface — adds GlobalObjectIdHash for Netcode prefab identification

INetworkScriptableFactory<TObject>

Adds NetworkSpawn() for spawning objects as NetworkObject instances with optional ownership and prediction

INetworkScriptableFactory<TObject, TData>

Adds variant-aware NetworkSpawn() for data-driven spawning with variant IDs

NetworkScriptableFactory<TObject>

Abstract implementation with prefab handler, spawn queues, and async spawn support

NetworkScriptableFactory<TObject, TData>

Extended implementation adding data variant support to network spawning

NetworkPrefabHandler

Integrates with Netcode's INetworkPrefabInstanceHandler to use factory pooling for network objects

NetworkFactorableData

Abstract record extending FactorableData with INetworkSerializable for network-transmitted data

Network Spawn Flow

spinner

Subsystems

Subsystem
Description

INetworkScriptableFactory interface hierarchy

See Also

Last updated