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 SnapshotDataBufferComponentLookup
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 |
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 | |
| DynamicBuffer<SnapshotDataBuffer> | data |
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 this spawning ghost.
Declaration
public bool HasBuffer<T>(int ghostTypeIndex) where T : unmanaged, IBufferElementData
Parameters
| Type | Name | Description |
|---|---|---|
| int | ghostTypeIndex | The index in the GhostCollectionPrefabSerializer collection |
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 GhostCollectionPrefabSerializer collection |
Returns
| Type | Description |
|---|---|
| bool |
Type Parameters
| Name | Description |
|---|---|
| T |
HasGhostOwner(in GhostSpawnBuffer)
Check if the spawning ghost has a GhostOwner.
Declaration
public bool HasGhostOwner(in GhostSpawnBuffer ghost)
Parameters
| Type | Name | Description |
|---|---|---|
| GhostSpawnBuffer | 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 |
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
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 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 |
Remarks
Buffers aren't supported.
Only component present on the root entity can be retrieved. Trying to get data for component 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
Declaration
public bool TryGetComponentDataFromSpawnBuffer<T>(in GhostSpawnBuffer ghost, in DynamicBuffer<SnapshotDataBuffer> snapshotData, out T componentData) where T : unmanaged, IComponentData
Parameters
| Type | Name | Description |
|---|---|---|
| GhostSpawnBuffer | ghost | |
| DynamicBuffer<SnapshotDataBuffer> | 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 component present on the root entity can be retrieved. Trying to get data for component in a child entity is not supported.