Struct SnapshotDataBufferComponentLookup
Helper struct that can be used to inspect the presence of components from a Snapshot
Inherited Members
Namespace: Unity.NetCode .LowLevel
Assembly: Unity.NetCode.dll
Syntax
public struct SnapshotDataBufferComponentLookup
Remarks
The helper only allows you to read component data. Buffers are not supported.
Methods
GetFallbackPredictionMode(in GhostSpawnBuffer)
Retrieve the prediction mode used as fallback if the spawning ghost has not been classified.
Declaration
public GhostSpawnBuffer.Type GetFallbackPredictionMode(in GhostSpawnBuffer ghost)
Parameters
Type | Name | Description |
---|---|---|
Ghost |
ghost |
Returns
Type | Description |
---|---|
Ghost |
The fallback mode to use |
GetGhostOwner(in GhostSpawnBuffer, in DynamicBuffer<SnapshotDataBuffer>)
Retrieve the network id of the player owning the ghost if the ghost archetype has a
Ghost
Declaration
public int GetGhostOwner(in GhostSpawnBuffer ghost, in DynamicBuffer<SnapshotDataBuffer> data)
Parameters
Type | Name | Description |
---|---|---|
Ghost |
ghost | |
Dynamic |
data |
Returns
Type | Description |
---|---|
int | the id of the player owning the ghost, if the Ghost |
HasBuffer<T>(int)
Check if the a component of type T
is present this spawning ghost.
Declaration
public bool HasBuffer<T>(int ghostTypeIndex) where T : unmanaged, IBufferElementData
Parameters
Type | Name | Description |
---|---|---|
int | ghostTypeIndex | The index in the Ghost |
Returns
Type | Description |
---|---|
bool |
Type Parameters
Name | Description |
---|---|
T |
HasComponent<T>(int)
Check if the a component of type T
is present this spawning ghost.
Declaration
public bool HasComponent<T>(int ghostTypeIndex) where T : unmanaged, IComponentData
Parameters
Type | Name | Description |
---|---|---|
int | ghostTypeIndex | The index in the Ghost |
Returns
Type | Description |
---|---|
bool |
Type Parameters
Name | Description |
---|---|
T |
HasGhostOwner(in GhostSpawnBuffer)
Check if the spawning ghost has a Ghost
Declaration
public bool HasGhostOwner(in GhostSpawnBuffer ghost)
Parameters
Type | Name | Description |
---|---|---|
Ghost |
ghost |
Returns
Type | Description |
---|---|
bool | True if the spawning ghost is owner predicted |
IsOwnerPredicted(in GhostSpawnBuffer)
Check if the spawning ghost mode is owner predicted.
Declaration
public bool IsOwnerPredicted(in GhostSpawnBuffer ghost)
Parameters
Type | Name | Description |
---|---|---|
Ghost |
ghost |
Returns
Type | Description |
---|---|
bool | True if the spawning ghost is owner predicted |
TryGetComponentDataFromSnapshotHistory<T>(int, in DynamicBuffer<SnapshotDataBuffer>, out T, int)
Try to retrieve the data for a component type T
from the the snapshot history buffer.
Declaration
public bool TryGetComponentDataFromSnapshotHistory<T>(int ghostTypeIndex, in DynamicBuffer<SnapshotDataBuffer> snapshotBuffer, out T componentData, int slotIndex = 0) where T : unmanaged, IComponentData
Parameters
Type | Name | Description |
---|---|---|
int | ghostTypeIndex | The index in the Ghost |
Dynamic |
snapshotBuffer | The entity snapshot history buffer. |
T | componentData | The deserialized component data. |
int | slotIndex | The slot in the history buffer to use. |
Returns
Type | Description |
---|---|
bool | True if the component is present and the component data is initialized. False otherwise |
Type Parameters
Name | Description |
---|---|
T |
Remarks
Buffers aren't supported. Only components present on the root entity can be retrieved. Trying to get data for components in a child entity is not supported.
TryGetComponentDataFromSpawnBuffer<T>(in GhostSpawnBuffer, in DynamicBuffer<SnapshotDataBuffer>, out T)
Try to retrieve the data for a component type T
from the spawning buffer.
Declaration
public bool TryGetComponentDataFromSpawnBuffer<T>(in GhostSpawnBuffer ghost, in DynamicBuffer<SnapshotDataBuffer> snapshotData, out T componentData) where T : unmanaged, IComponentData
Parameters
Type | Name | Description |
---|---|---|
Ghost |
ghost | |
Dynamic |
snapshotData | |
T | componentData |
Returns
Type | Description |
---|---|
bool | True if the component is present and the component data is initialized. False otherwise |
Type Parameters
Name | Description |
---|---|
T |
Remarks
Buffers aren't supported. Only components present on the root entity can be retrieved. Trying to get data for components in a child entity is not supported.