Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

ArchetypeChunk.DidChange

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public bool DidChange(ref ComponentTypeHandle`1 typeHandle, uint version);

Parameters

Parameter Description
typeHandle An object containing type and job safety information. To create this object, call ComponentSystemBase.GetComponentTypeHandle. Pass the object to a job using a public field you define as part of the job struct.
version The version to compare. In a system, this parameter should be set to the current ComponentSystemBase.LastSystemVersion at the time the job is run or scheduled.

Returns

bool True, if the version number stored in the chunk for this component is more recent than the version passed to the version parameter.

Description

Reports whether the data in any of IComponentData components in the chunk, of the type identified by typeHandle, could have changed since the specified version.

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 EntityManager.GlobalSystemVersion value. Since every system stores the global system version in its ComponentSystemBase.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.


Declaration

public bool DidChange(ref DynamicComponentTypeHandle typeHandle, uint version);

Parameters

Parameter Description
typeHandle An object containing type and job safety information. To create this object, call ComponentSystemBase.GetDynamicComponentTypeHandle. Pass the object to a job using a public field you define as part of the job struct.
version The version to compare. In a system, this parameter should be set to the current ComponentSystemBase.LastSystemVersion at the time the job is run or scheduled.

Returns

bool True, if the version number stored in the chunk for this component is more recent than the version passed to the version parameter.

Description

Reports whether the data in any of IComponentData components in the chunk, of the type identified by typeHandle, could have changed since the specified version.

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 EntityManager.GlobalSystemVersion value. Since every system stores the global system version in its ComponentSystemBase.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.


Declaration

public bool DidChange(ref BufferTypeHandle`1 bufferTypeHandle, uint version);

Parameters

Parameter Description
bufferTypeHandle An object containing type and job safety information. To create this object, call ComponentSystemBase.GetBufferTypeHandle. Pass the object to a job using a public field you define as part of the job struct.
version The version to compare. In a system, this parameter should be set to the current ComponentSystemBase.LastSystemVersion at the time the job is run or scheduled.

Returns

bool True, if the version number stored in the chunk for this component is more recent than the version passed to the version parameter.

Description

Reports whether any of the data in dynamic buffer components in the chunk, of the type identified by bufferTypeHandle, could have changed since the specified version.

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 EntityManager.GlobalSystemVersion value. Since every system stores the global system version in its ComponentSystemBase.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.


Declaration

public bool DidChange(SharedComponentTypeHandle<T> chunkSharedComponentData, uint version);

Parameters

Parameter Description
chunkSharedComponentData An object containing type and job safety information. To create this object, call ComponentSystemBase.GetSharedComponentTypeHandle. Pass the object to a job using a public field you define as part of the job struct.
version The version to compare. In a system, this parameter should be set to the current ComponentSystemBase.LastSystemVersion at the time the job is run or scheduled.

Returns

bool True, if the version number stored in the chunk for this component is more recent than the version passed to the version

Description

Reports whether the value of shared components associated with the chunk, of the type identified by chunkSharedComponentData, could have changed since the specified version.

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.


Declaration

public bool DidChange(ref DynamicSharedComponentTypeHandle typeHandle, uint version);

Parameters

Parameter Description
typeHandle An object containing type and job safety information. To create this object, call ComponentSystemBase.GetDynamicSharedComponentTypeHandle.
version The version to compare. In a system, this parameter should be set to the current ComponentSystemBase.LastSystemVersion.

Returns

bool True, if the version number stored in the chunk for this component is more recent than the version passed to the version

Description

Reports whether the value of shared components associated with the chunk, of the type identified by typeHandle, could have changed since the specified version.

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.