INetworkScriptableFactory
Base interface for all network-aware factories. Extends IScriptableFactory by adding a GlobalObjectIdHash property that identifies the factory's prefab within Unity Netcode's network prefab system.
Definition
Namespace: Paragon.Core.Network Assembly: Paragon.dll
public interface INetworkScriptableFactory : IScriptableFactoryExtends: IScriptableFactory
Remarks
INetworkScriptableFactory is the non-generic entry point for the network factory interface hierarchy. It adds a single property — GlobalObjectIdHash — which maps to the NetworkObject.GlobalObjectIdHash on the factory's prefab. This hash is used by Netcode to:
Identify prefabs during network spawn replication
Register custom prefab handlers via
NetworkManager.PrefabHandlerMatch spawn requests between server and client
The hash is typically extracted from the prefab's NetworkObject component during factory initialization and cached for the factory's lifetime.
Quick Lookup
Get Netcode prefab hash
factory.GlobalObjectIdHash
Check if factory is network-aware
factory is INetworkScriptableFactory
Use as regular factory
Cast to IScriptableFactory (inherited)
Properties
GlobalObjectIdHash
The NetworkObject.GlobalObjectIdHash of the factory's prefab. Used by Netcode for prefab identification and custom prefab handler registration.
Returns: The hash value from the prefab's NetworkObject component.
Implementation Requirements
When implementing INetworkScriptableFactory, you MUST:
Return the
GlobalObjectIdHashfrom the factory's prefabNetworkObjectEnsure the prefab has a
NetworkObjectcomponent attachedSatisfy all IScriptableFactory requirements (lifecycle,
gameObject,transform)
In practice, subclass NetworkScriptableFactory<TObject> rather than implementing this interface directly. It extracts the hash from the prefab automatically during Initialize().
Common Pitfalls
Missing NetworkObject component If the factory's prefab does not have a NetworkObject component, GlobalObjectIdHash cannot be resolved. The concrete implementations extract this via reflection on the prefab, so a missing component will cause initialization failures.
Hash changes on prefab modification Unity regenerates GlobalObjectIdHash when certain prefab properties change. If external systems cache this hash, they may become stale after prefab edits. The factory re-reads the hash on each Initialize(), so runtime usage is safe.
See Also
INetworkScriptableFactory<TObject> — adds
NetworkSpawn()with ownershipINetworkScriptableFactory<TObject, TData> — adds variant-aware
NetworkSpawn()IScriptableFactory — parent interface
Network Factory Interfaces — interface hierarchy overview
Last updated