public sealed class NetworkSpawnSystemTurns arrived spawns into instances. Client-side.
No guide page documents this yet — the page shows what the code says about itself.
As a system
- Phase
- EarlyUpdate
- Reads
- NetworkId NetworkSpawn
Remarks
A query, not a queue. An entity carrying a NetworkSpawn and not a NetworkInstance is work outstanding, and that is the whole of the state this keeps — so a spawn for a scene that is still loading, or for a prefab whose bundle has not arrived, is simply still outstanding next frame and builds itself the moment its precondition is met. A queue would have needed a retry policy, a dead-letter rule and a way to notice that neither ever fires.
The entity it starts from is usually a stand-in it did not make. A snapshot names an entity by id and ReplicationClient makes a bare one for an id it has not seen, so by the time a spawn is read the entity may already be carrying a position, a velocity, and whatever else arrived in the same snapshot. Building the prefab over it — rather than beside it — is what keeps that state, and the prefab's own defaults lose wherever the two overlap. See InstantiateOnto.
Fields and properties (7)
public SystemAccess AccessWhat this system reads and writes.
public ReplicationClient? ClientThe client to tell which entity each id became. Optional, and wanted in a real client.
public SceneManager? ScenesThe scenes this peer has loaded. Optional; without it instances belong to no scene.
public NetworkSceneMap? SceneIdsWhich networked scene each local one is. Needed with Scenes.
public NetworkOwnership? OwnershipWho owns what, kept in step with what the spawns say. Optional.
public long BuiltCountHow many instances have been built.
public int PendingCountHow many spawns were outstanding at the end of the last pass.
Methods (3)
public NetworkSpawnSystem(NetworkPrefabRegistry prefabs)Creates the system.
public override JobHandle Update(in SystemContext context, JobHandle dependency)Runs the system.
public int Build(World world)Builds every instance whose spawn has arrived and whose prefab and scene are here.
Used by (1)
- NetworkSpawnTestsVixen.Net.Engine.Tests