Vixen
02b45cc4
csharp
public sealed class NetworkSpawnSystem

Turns 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

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 Access

    What this system reads and writes.

  • public ReplicationClient? Client

    The client to tell which entity each id became. Optional, and wanted in a real client.

  • public SceneManager? Scenes

    The scenes this peer has loaded. Optional; without it instances belong to no scene.

  • public NetworkSceneMap? SceneIds

    Which networked scene each local one is. Needed with Scenes.

  • public NetworkOwnership? Ownership

    Who owns what, kept in step with what the spawns say. Optional.

  • public long BuiltCount

    How many instances have been built.

  • public int PendingCount

    How many spawns were outstanding at the end of the last pass.

Methods (3)

Used by (1)

  • NetworkSpawnTestsVixen.Net.Engine.Tests