Struct GhostCount
Singleton component with APIs and collections required for Ghost counting.
Inherited Members
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
[BurstCompile]
public struct GhostCount : IComponentData, IQueryTypeParameter
Properties
GhostCountInstantiatedOnClient
The total number of relevant (to our connection) ghosts that the client has actually instantiated
(but skips/ignores Pending
Zero if Is
Declaration
public int GhostCountInstantiatedOnClient { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
Note: If the relevant set suddenly changes - or the server destroys many ghosts within a single frame - it's possible to have more ghosts on the client than the client should have.
See Also
GhostCountOnClient
The total number of relevant (to our connection) ghosts that the client has received (NOT instantiated!).
Count is updated any time a snapshot is received and processed.
The number of received ghosts can be different from the number of currently spawned ghosts.
Zero if Is
Declaration
[Obsolete("Prefer either GhostCountInstantiatedOnClient or GhostCountReceivedOnClient, as this variable is ambiguous (and maps to GhostCountReceivedOnClient). RemoveAfter 1.x.", false)]
public int GhostCountOnClient { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
Note: If the relevant set suddenly changes - or the server destroys many ghosts within a single frame - it's possible to have more ghosts on the client than the client should have.
See Also
GhostCountOnServer
The total number of relevant (to our connection) ghosts that the server wishes to send this client. Sent in each snapshot, thus count is updated whenever a snapshot was received.
Declaration
public int GhostCountOnServer { get; }
Property Value
Type | Description |
---|---|
int |
See Also
GhostCountReceivedOnClient
The total number of relevant (to our connection) ghosts that the client has received (NOT instantiated!).
Count is updated any time a snapshot is received and processed.
The number of received ghosts can be different from the number of currently spawned ghosts.
Zero if Is
Declaration
public int GhostCountReceivedOnClient { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
Note: If the relevant set suddenly changes - or the server destroys many ghosts within a single frame - it's possible to have more ghosts on the client than the client should have.
See Also
InstantiatedPercent
Denotes the percentage of ghosts instantiated on the client (Ghost
Only counts relevant ghosts!
0% when no ghosts are expected: I.e. No ghosts spawned on server, or no ghosts considered relevant,
or if this struct is not initialized (i.e. when Is
Declaration
public float InstantiatedPercent { get; }
Property Value
Type | Description |
---|---|
float |
Remarks
Note: If the relevant set suddenly changes - or the server destroys many ghosts within a single frame -
it's possible to have more ghosts on the client than the client should have. Therefore, this value can be
greater than 100%.
Also note: Due to above nuances, it's possible to have the correct count of ghosts, but it's the
incorrect set. In other words: This percentage is a naive approximation of 'the client has replicated
everything they need'.
IsCreated
Helper denoting if the values are valid.
Declaration
public bool IsCreated { get; }
Property Value
Type | Description |
---|---|
bool |
ReceivedPercent
Denotes the percentage of ghosts received by the client (Ghost
Only counts relevant ghosts!
0% when no ghosts are expected: I.e. No ghosts spawned on server, or no ghosts considered relevant,
or if this struct is not initialized (i.e. when Is
Declaration
public float ReceivedPercent { get; }
Property Value
Type | Description |
---|---|
float |
Remarks
Note: If the relevant set suddenly changes - or the server destroys many ghosts within a single frame -
it's possible to have more ghosts on the client than the client should have. Therefore, this value can be
greater than 100%.
Also note: Due to above nuances, it's possible to have the correct count of ghosts, but it's the
incorrect set. In other words: This percentage is a naive approximation of 'the client has replicated
everything they need'.
Methods
ToFixedString()
For debugging and logging.
Declaration
public FixedString128Bytes ToFixedString()
Returns
Type | Description |
---|---|
Fixed |
Logs |