Struct SnapshotDataLookupHelper
Helper struct that can be used in your spawn classification systems (and classification jobs) to create SnapshotDataBufferComponentLookup instances. In order to use the helper, the system that create/hold the instance, must be created after the GhostCollectionSystem and after the GhostReceiveSystem, because of the need to retrieve the SpawnedGhostEntityMap and the Unity.NetCode.LowLevel.SnapshotDataLookupCache data.
Inherited Members
Namespace: Unity.NetCode.LowLevel
Syntax
public struct SnapshotDataLookupHelper
Constructors
SnapshotDataLookupHelper(ref SystemState, Entity, Entity)
Default constructor, collect and initialize all the internal BufferFromEntity<T> handles and collect the necessary data structures.
Declaration
public SnapshotDataLookupHelper(ref SystemState state, Entity ghostCollectionEntity, Entity spawnMapEntity)
Parameters
Type | Name | Description |
---|---|---|
SystemState | state | |
Entity | ghostCollectionEntity | The entity that hold the GhostCollection component |
Entity | spawnMapEntity | The entity that hold the SpawnedGhostEntityMap component |
Methods
CreateSnapshotBufferLookup()
Create a new SnapshotDataBufferComponentLookup instance that can be used on the main thread or in job. This method introduce a sync point, because internally retrieve all the necessary DynamicBuffer<T>.
Declaration
public SnapshotDataBufferComponentLookup CreateSnapshotBufferLookup()
Returns
Type | Description |
---|---|
SnapshotDataBufferComponentLookup | A valid SnapshotDataBufferComponentLookup instance |
Remarks
The method requires that the Update(ref SystemState) method has been called and that all the internal handles has been updated.
Update(ref SystemState)
Call this method in your system OnUpdate to refresh all the internal BufferFromEntity<T> handles.
Declaration
public void Update(ref SystemState state)
Parameters
Type | Name | Description |
---|---|---|
SystemState | state |