Struct SnapshotDataBufferComponentLookup
Helper struct that can be used to inspect the presence of components from a SnapshotData buffer and retrieve their data. The lookup can be passed ot jobs
Inherited Members
Namespace: Unity.NetCode.LowLevel
Assembly: Unity.NetCode.dll
Syntax
public struct SnapshotDataBufferComponentLookupRemarks
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 | 
|---|---|---|
| GhostSpawnBuffer | ghost | The spawning ghost | 
Returns
| Type | Description | 
|---|---|
| GhostSpawnBuffer.Type | 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 GhostOwner.
Declaration
public int GetGhostOwner(in GhostSpawnBuffer ghost, in DynamicBuffer<SnapshotDataBuffer> data)Parameters
| Type | Name | Description | 
|---|---|---|
| GhostSpawnBuffer | ghost | The spawning ghost | 
| DynamicBuffer<SnapshotDataBuffer> | data | Snapshot data buffers | 
Returns
| Type | Description | 
|---|---|
| int | the id of the player owning the ghost, if the GhostOwner is present, 0 otherwise. | 
HasBuffer<T>(int)
Check if the a component of type T is present in this spawning ghost.
Declaration
public bool HasBuffer<T>(int ghostTypeIndex) where T : unmanaged, IBufferElementDataParameters
| Type | Name | Description | 
|---|---|---|
| int | ghostTypeIndex | The index in the GhostCollectionPrefabSerializer collection | 
Returns
| Type | Description | 
|---|---|
| bool | Whether the type is present in this spawning ghost | 
Type Parameters
| Name | Description | 
|---|---|
| T | Component type | 
Remarks
This work for both IComponentData and IBufferElementData
HasComponent<T>(int)
Check if the component of type T is present in this spawning ghost.
Declaration
public bool HasComponent<T>(int ghostTypeIndex) where T : unmanaged, IComponentDataParameters
| Type | Name | Description | 
|---|---|---|
| int | ghostTypeIndex | The index in the GhostCollectionPrefabSerializer collection | 
Returns
| Type | Description | 
|---|---|
| bool | Whether the component is present in this spawning ghost. | 
Type Parameters
| Name | Description | 
|---|---|
| T | Component type in spawning ghost. | 
Remarks
This work for both IComponentData and IBufferElementData
HasGhostOwner(in GhostSpawnBuffer)
Check if the spawning ghost has a GhostOwner.
Declaration
public bool HasGhostOwner(in GhostSpawnBuffer ghost)Parameters
| Type | Name | Description | 
|---|---|---|
| GhostSpawnBuffer | ghost | The spawning 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 | 
|---|---|---|
| GhostSpawnBuffer | ghost | The spawning 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, IComponentDataParameters
| Type | Name | Description | 
|---|---|---|
| int | ghostTypeIndex | The index in the GhostCollectionPrefabSerializer collection. | 
| DynamicBuffer<SnapshotDataBuffer> | 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 | Component type | 
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, IComponentDataParameters
| Type | Name | Description | 
|---|---|---|
| GhostSpawnBuffer | ghost | Spawning buffer | 
| DynamicBuffer<SnapshotDataBuffer> | snapshotData | Snapshot data | 
| T | componentData | Component data | 
Returns
| Type | Description | 
|---|---|
| bool | True if the component is present and the component data is initialized. False otherwise | 
Type Parameters
| Name | Description | 
|---|---|
| T | Component type | 
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.