Method DidChange
DidChange<T>(ComponentTypeHandle<T>, UInt32)
Reports whether the data in any of IComponentData components in the chunk, of the type identified by
chunkComponentTypeHandle
, could have changed since the specified version.
Declaration
public bool DidChange<T>(ComponentTypeHandle<T> chunkComponentTypeHandle, uint version)
where T : IComponentData
Parameters
Type | Name | Description |
---|---|---|
ComponentTypeHandle<T> | chunkComponentTypeHandle | An object containing type and job safety information. Create this object by calling GetComponentTypeHandle<T>(Boolean) immediately before scheduling a job. Pass the object to a job using a public field you define as part of the job struct. |
UInt32 | version | The version to compare. In a system, this parameter should be set to the current LastSystemVersion at the time the job is run or scheduled. |
Returns
Type | Description |
---|---|
Boolean | True, if the version number stored in the chunk for this component is more recent than the version
passed to the |
Type Parameters
Name | Description |
---|---|
T | The component type. |
Remarks
When you access a component in a chunk with write privileges, the ECS framework updates the change version of that component type to the current GlobalSystemVersion value. Since every system stores the global system version in its LastSystemVersion field when it updates, you can compare these two versions with this function in order to determine whether the data of components in this chunk could have changed since the last time that system ran.
Note that for efficiency, the change version applies to whole chunks not individual entities. The change version is updated even when another job or system that has declared write access to a component does not actually change the component value.
DidChange(DynamicComponentTypeHandle, UInt32)
Reports whether the data in any of IComponentData components in the chunk, of the type identified by
chunkComponentType
, could have changed since the specified version.
Declaration
public bool DidChange(DynamicComponentTypeHandle chunkComponentType, uint version)
Parameters
Type | Name | Description |
---|---|---|
DynamicComponentTypeHandle | chunkComponentType | An object containing type and job safety information. Create this object by calling GetDynamicComponentTypeHandle(ComponentType) immediately before scheduling a job. Pass the object to a job using a public field you define as part of the job struct. |
UInt32 | version | The version to compare. In a system, this parameter should be set to the current LastSystemVersion at the time the job is run or scheduled. |
Returns
Type | Description |
---|---|
Boolean | True, if the version number stored in the chunk for this component is more recent than the version
passed to the |
Remarks
When you access a component in a chunk with write privileges, the ECS framework updates the change version of that component type to the current GlobalSystemVersion value. Since every system stores the global system version in its LastSystemVersion field when it updates, you can compare these two versions with this function in order to determine whether the data of components in this chunk could have changed since the last time that system ran.
Note that for efficiency, the change version applies to whole chunks not individual entities. The change version is updated even when another job or system that has declared write access to a component does not actually change the component value.
DidChange<T>(BufferTypeHandle<T>, UInt32)
Reports whether any of the data in dynamic buffer components in the chunk, of the type identified by
chunkBufferTypeHandle
, could have changed since the specified version.
Declaration
public bool DidChange<T>(BufferTypeHandle<T> chunkBufferTypeHandle, uint version)
where T : struct, IBufferElementData
Parameters
Type | Name | Description |
---|---|---|
BufferTypeHandle<T> | chunkBufferTypeHandle | An object containing type and job safety information. Create this object by calling GetBufferTypeHandle<T>(Boolean) immediately before scheduling a job. Pass the object to a job using a public field you define as part of the job struct. |
UInt32 | version | The version to compare. In a system, this parameter should be set to the current LastSystemVersion at the time the job is run or scheduled. |
Returns
Type | Description |
---|---|
Boolean | True, if the version number stored in the chunk for this component is more recent than the version
passed to the |
Type Parameters
Name | Description |
---|---|
T | The data type of the elements in the dynamic buffer. |
Remarks
When you access a component in a chunk with write privileges, the ECS framework updates the change version of that component type to the current GlobalSystemVersion value. Since every system stores the global system version in its LastSystemVersion field when it updates, you can compare these two versions with this function in order to determine whether the data of components in this chunk could have changed since the last time that system ran.
Note that for efficiency, the change version applies to whole chunks not individual entities. The change version is updated even when another job or system that has declared write access to a component does not actually change the component value.
DidChange<T>(SharedComponentTypeHandle<T>, UInt32)
Reports whether the value of shared components associated with the chunk, of the type identified by
chunkSharedComponentData
, could have changed since the specified version.
Declaration
public bool DidChange<T>(SharedComponentTypeHandle<T> chunkSharedComponentData, uint version)
where T : struct, ISharedComponentData
Parameters
Type | Name | Description |
---|---|---|
SharedComponentTypeHandle<T> | chunkSharedComponentData | An object containing type and job safety information. Create this object by calling GetSharedComponentTypeHandle<T>() immediately before scheduling a job. Pass the object to a job using a public field you define as part of the job struct. |
UInt32 | version | The version to compare. In a system, this parameter should be set to the current LastSystemVersion at the time the job is run or scheduled. |
Returns
Type | Description |
---|---|
Boolean | True, if the version number stored in the chunk for this component is more recent than the version
passed to the |
Type Parameters
Name | Description |
---|---|
T | The data type of the shared component. |
Remarks
Shared components behave differently than other types of components in terms of change versioning because changing the value of a shared component can move an entity to a different chunk. If the change results in an entity moving to a different chunk, then only the order version is updated (for both the original and the receiving chunk). If you change the shared component value for all entities in a chunk at once, the change version for that chunk is updated. The order version is unaffected.
Note that for efficiency, the change version applies to whole chunks not individual entities. The change version is updated even when another job or system that has declared write access to a component does not actually change the component value.
DidChange(DynamicSharedComponentTypeHandle, UInt32)
Reports whether the value of shared components associated with the chunk, of the type identified by
chunkSharedComponentData
, could have changed since the specified version.
Declaration
public bool DidChange(DynamicSharedComponentTypeHandle chunkSharedComponentData, uint version)
Parameters
Type | Name | Description |
---|---|---|
DynamicSharedComponentTypeHandle | chunkSharedComponentData | An object containing type and job safety information. Create this object by calling GetDynamicSharedComponentTypeHandle(ComponentType). |
UInt32 | version | The version to compare. In a system, this parameter should be set to the current LastSystemVersion. |
Returns
Type | Description |
---|---|
Boolean | True, if the version number stored in the chunk for this component is more recent than the version
passed to the |
Remarks
Shared components behave differently than other types of components in terms of change versioning because changing the value of a shared component can move an entity to a different chunk. If the change results in an entity moving to a different chunk, then only the order version is updated (for both the original and the receiving chunk). If you change the shared component value for all entities in a chunk at once, the change version for that chunk is updated. The order version is unaffected.
Note that for efficiency, the change version applies to whole chunks not individual entities. The change version is updated even when another job or system that has declared write access to a component does not actually change the component value.