public sealed class NetworkPrefabRegistryWhat may be spawned, on both ends of the wire.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Both peers build this from the same content, so neither has to send it. A prefab's id is a function of its address ([08](../../../docs/plan/08-asset-pipeline-and-addressables.md)), so a server that registers gameplay/prefabs/crate and a client that registers the same address agree without a handshake. What the handshake is for is noticing that they registered different content under it, which is the catalog's hash rather than this registry's business.
Which nodes get ids is decided here, once. A prefab is a subtree and most of it is scenery: a hundred-entity set piece where one turret rotates should cost one id and one record, not a hundred of each. The rule is that a template node carrying a NetworkId wants one — so a designer opts an entity into being addressable by putting the component on it — plus the root, which needs one whether or not anybody remembered, because the root is what the spawn itself is addressed to.
Fields and properties (2)
public int CountHow many are registered.
public IEnumerable<NetworkPrefab> PrefabsEverything registered, in no particular order.
Methods (4)
public NetworkPrefabId Register(string address, Prefab prefab)Registers a prefab under an address.
public bool TryGet(NetworkPrefabId id, out NetworkPrefab? prefab)Finds a prefab by id.
public bool TryGet(string address, out NetworkPrefab? prefab)Finds a prefab by address.
public NetworkPrefab Require(string address)Finds a prefab by address, or says why not.
Used by (4)
- NetworkSpawnSystemVixen.Net.Engine
- NetworkSpawnTestsVixen.Net.Engine.Tests
- NetworkSpawnerVixen.Net.Engine
- PlayerSpawnerTestsVixen.Net.Engine.Tests