Entities list
This page contains a list of all entities used by the Netcode package.
Connection
A connection entity is created for each network connection. You can think of these entities as your network socket, but they do contain a bit more data and configuration for other Netcode systems.
| Component |
Description |
Condition |
| NetworkStreamConnection |
The Unity Transport NetworkConnection used to send and receive data. |
|
| NetworkSnapshotAckComponent |
Data used to keep track of what data has been received. |
|
| CommandTargetComponent |
A pointer to the entity where commands should be read from or written too. The target entity must have a ICommandData component on it. |
|
| IncomingRpcDataStreamBufferComponent |
A buffer of received RPC commands which will be processed by the RpcSystem. Intended for internal use only. |
|
| IncomingCommandDataStreamBufferComponent |
A buffer of received commands which will be processed by a generated CommandReceiveSystem. Intended for internal use only. |
Server only |
| OutgoingCommandDataStreamBufferComponent |
A buffer of commands generated be a CommandSendSystem which will be sent to the server. Intended for internal use only. |
Client only |
| IncomingSnapshotDataStreamBufferComponent |
A buffer of received snapshots which will be processed by the GhostReceiveSystem. Intended for internal use only. |
Client only |
| OutgoingRpcDataStreamBufferComponent |
A buffer of RPC commands which should be sent by the RpcSystem. Intended for internal use only, use an RpcQueue or IRpcCommand component to write RPC data. |
|
| NetworkIdComponent |
The network id is used to uniquely identify a connection. If this component does not exist the connection is not yet complete. |
Added automatically when connection is complete |
| NetworkStreamInGame |
A component used to signal that a connection should send and receive snapshots and commands. Before adding this component the connection only processes RPCs. |
Added by game logic to start sending snapshots and commands. |
| NetworkStreamRequestDisconnect |
A component used to signal that the game logic wants to close the connection. |
Added by game logic to disconnect. |
| NetworkStreamDisconnected |
A component used to signal that a connection has been disconnected. The entity will exist with this component for one frame, after that it is automatically deleted. |
Added automatically when a connection is disconnected. |
| NetworkStreamSnapshotTargetSize |
Used to tell the GhostSendSystem on the server to use a non-default packet size for snapshots. |
Added by game logic to change snapshot packet size. |
| GhostConnectionPosition |
Used by the distance based importance system to scale importance of ghosts based on distance from the player. |
Added by game logic to specify the position of the player for a connection. |
| PrespawnSectionAck |
Used by the server to track which subscenes the client has loaded. |
Server only |
| EnablePacketLogging |
Added by game logic to enable packet dumps for a single connection. |
Only when enabling packet dumps |
Ghost
A ghost is an entity on the server which is ghosted (replicated) to the clients. It is always instantiated from a ghost prefab and has user defined data in addition to the components listed here which control its behavior.
| Component |
Description |
Condition |
| GhostComponent |
Identifying an entity as a ghost. |
|
| GhostTypeComponent |
The type this ghost belongs to. |
|
| GhostSystemStateComponent |
This component exists for only for internal use in the NetCode package. Used to track despawn of ghosts on the server. |
Server only |
| SharedGhostTypeComponent |
A shared component version of the GhostTypeComponent, used on the server only to make sure different ghost types never share the same chunk. |
Server only |
| SnapshotData |
A buffer with meta data about the snapshots received from the server. |
Client only |
| SnapshotDataBuffer |
A buffer with the raw snapshot data received from the server. |
Client only |
| SnapshotDynamicDataBuffer |
A buffer with the raw snapshot data for buffers received from the server. |
Client only, ghosts with buffers only |
| PredictedGhostComponent |
Identify predicted ghosts. On the server all ghosts are considered predicted and have this component. |
Predicted only |
| GhostDistancePartition |
Added to all ghosts with a Translation when distance based importance is used. |
Only for distance based importance |
| GhostDistancePartitionShared |
Added to all ghosts with a Translation when distance based importance is used. |
Only for distance based importance |
| GhostPrefabMetaDataComponent |
The meta data for a ghost, adding durin conversion and used to setup serialiation. This is not required on ghost instances, only on prefabs, but it is only removed from pre-spawned right now. |
Not in pre-spawned |
| GhostChildEntityComponent |
Disable the serialization of this entity because it is part of a ghost group and will be serialized as part of that. |
Only children in ghost groups |
| GhostGroup |
Added to all ghosts which can be the owner of a ghost group. Must be added to the prefab at conversion time. |
Only ghost group root |
| PredictedGhostSpawnRequestComponent |
This instance is not a ghost received from the server, but a request to predictively spawn a ghost which the client expets the server to spawn soon. This should only be added by calling GhostCollectionSystem.CreatePredictedSpawnPrefab |
Only predicted spawn requests |
| GhostOwnerComponent |
Identiy the owner of a ghost, specified as a network id. |
Optional |
| AutoCommandTarget |
Automatically send all ICommandData if the ghost is owned by the current connection, AutoCommandTarget.Enabled is true and the ghost is predicted. |
Optional |
| SubSceneGhostComponentHash |
The hash of all pre-spawned ghosts in a subscene, used for sorting and grouping. This is a shared component. |
Only pre-spawned |
| PreSpawnedGhostIndex |
Unique index of a pre-spawned ghost within a subscene. |
Only pre-spawned |
| PrespawnGhostBaseline |
The snapshot data a pre-spawned ghost had in the scene data. Used as a fallback baseline. |
Only pre-spawned |
| GhostPrefabRuntimeStrip |
Added to prefabs and pre-spawned during conversion to client and server data to trigger runtime stripping of component. |
Only on prefabs in client and server scenes before they are initialized |
| LiveLinkPrespawnSectionReference |
Component present in editor on the scene section entity when the sub-scene is open for edit. |
Only in Editor |
|PreSerializedGhost | Enable pre-serialization for a ghost, added at conversion time based on ghost settings. | Only ghost using pre-serialization
|SwitchPredictionSmoothing | Added temporarily when switching a ghost between predicted / interpolated with a transition time to handle transform smoothing. | Only ghost in the process of switching prediction mode
|PrefabDebugName | Name of the prefab used for debugging. | Only on prefabs when NETCODE_DEBUG is enabled
Placeholder ghost
When a ghost is received but is not yet supposed to be spawned the client will create a placeholder to store the data until it is time to spawn it. The placeholder ghosts only exist on clients and have these components
RPC
RPC entities are created with a send request in order to send RPCs. When they are received the system will create entities with the RPC component and a receive request.
Netcode RPCs
| Component |
Description |
| RpcSetNetworkId |
Special RPC only sent on connect. |
| ClientServerTickRateRefreshRequest |
Special RPC only sent on connect. |
| HeartbeatComponent |
Send at regular intervals when not in game to make sure the connection does not time out. |
| StartStreamingSceneGhosts |
Sent from client to server when a subscene has been loaded. |
| StopStreamingSceneGhosts |
Sent from client to server when a subscene will be unloaded. |
CommandData
Every connection which is receiving commands from a client needs to have an entity to hold the command data. This can be a ghost, the connection entity itself or some other entity.
| Component |
Description |
Condition |
| ICommandData |
A specific implemenation of the ICommandData interface. This can be added to any entity, the connections CommandTargetComponent must point to an entity containing this. |
|
| CommandDataInterpolationDelay |
Optional component used to access the interpolation delay in order to implement lag compensation on hte server. Also exists on predicted clients but always has an interpolation delay of 0 there. |
Added by game logic, predicted only |
Netcode CommandData
| Component |
Description |
| NullCommandData |
Special CommandData sent when command target is null to make sure ping and ack messages still work. |
SceneSection
When using pre-spawned ghosts Netcode will add some components to the SceneSection entity containing the ghosts.
Netcode created singletons
PredictedGhostSpawnList
A singleton with a list of all predicted spawned ghosts which are waiting for a ghost from the server. This is needed when writing logic matching an incoming ghost with a pre-spawned one.
Ghost Collection
| Component |
Description |
| GhostCollection |
Identify the singleton containing ghost prefabs. |
| GhostCollectionPrefab |
A list of all ghost prefabs which can be instantiated. |
| GhostCollectionPrefabSerializer |
A list of serializers for all ghost prefabs. The index in this list is identical to GhostCollectionPrefab, but it can temporarily have fewer entries when a prefab is loading. This references a range in the GhostCollectionComponentIndex list. |
| GhostCollectionComponentType |
The set of serializers in the GhostComponentSerializer.State which can be used for a given type. This is used internally to setup the GhostCollectionPrefabSerializer. |
| GhostCollectionComponentIndex |
A list of mappings from prefab serializer index to a child entity index and a GhostComponentSerializer.State index. This mapping is there to avoid having to duplicate the full serialization state for each prefab using the same component. |
| GhostComponentSerializer.State |
Serialization state - including function pointers for serialization - for a component type and variant. There can be more than one entry for a given component type if there are serialization variants. |
Spawn queue
| Component |
Description |
| GhostSpawnQueueComponent |
Identifier for the ghost spawn queue. |
| GhostSpawnBuffer |
A list of ghosts in the spawn queue. This queue is written by the GhostReceiveSystem and read by the GhostSpawnSystem. A classification system running between those two can change the type of ghost to sapwn and match incomming ghosts with pre-spawned ghosts. |
| SnapshotDataBuffer |
Raw snapshot data for the new ghosts in the GhostSpawnBuffer. |
NetworkProtocolVersion
| Component |
Description |
| NetworkProtocolVersion |
The network protocol version for RPCs, ghost component serializers, netcode version and game version. At connection time netcode will validate that the client and server has the same version. |
PrespawnGhostIdAllocator
| Component |
Description |
| PrespawnGhostIdRange |
The set of ghost ids assosiated with a subscene. Used by the server to map prspawned ghosts for a subscene to proper ghost ids. |
PrespawnSceneLoaded
This singleton is a special kind of ghost without a prefab asset.
| Component |
Description |
| PrespawnSceneLoaded |
The set of scenes with pre-spawned ghosts loaded by the server. This is ghosted to clients. |
MigrationTicket
| Component |
Description |
| MigrationTicket |
Created in the new world when using world migration, triggers the restore part of migration. |
SmoothingAction
| Component |
Description |
| SmoothingAction |
Singleton created when a smothing action is registered in order to enable the smoothing system. |
User create singletons (settings)
ClientServerTickRate
| Component |
Description |
| ClientServerTickRate |
The tick rate settings for the server. Automatically sent and set on the client based on the values specified on the server. |
ClientTickRate
| Component |
Description |
| ClientTickRate |
The tick rate settings for the client which are not controlled by the server (interpolation time etc.). Use the defaults from NetworkTimeSystem.DefaultClientTickRate instead of default values. |
ThinClient
| Component |
Description |
| ThinClientComponent |
The world is a thin client world and will not process incomming snapshots. Automatically create for thin client worlds, creating this singleton in a user spawned world makes it a thin client. |
LagCompensationConfig
| Component |
Description |
| LagCompensationConfig |
Configuration for the PhysicsWorldHistory system which is used to implement lag compensation on the server. If the singleton does not exist PhysicsWorldHistory will no be run. |
GameProtocolVersion
| Component |
Description |
| GameProtocolVersion |
The game specific version to use for protcol validation on connection. If this does not exist 0 will be used, but the protocol will still validate netcode version, ghost components and rpcs |
Ghost distance importance
| Component |
Description |
| GhostDistanceImportance |
Settings for distance based importance. If the singleton does not exist distance based importance is not used. |
PredictedPhysicsConfig
| Component |
Description |
| PredictedPhysicsConfig |
Create a singleton with this to enable and configure predicted physics. |
NetCodeDebugConfig
| Component |
Description |
| NetCodeDebugConfig |
Create a singleton with this to configure log level and packet dump for all connections. See EnabledPacketLogging on the connection for enabling packet dumps for a subset of the connections. |
DisableAutomaticPrespawnSectionReporting
| Component |
Description |
| DisableAutomaticPrespawnSectionReporting |
Disable the automatic tracking of which sub-scenes the client has loaded. When creating this singleton you must implement custom logic to make sure the server does not send pre-spawned ghosts which the client has not loaded. |