# DidChange

> 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.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

## DidChange\<T>(ComponentTypeHandle\<T>, uint)

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.

```csharp
public readonly bool DidChange<T>(ref ComponentTypeHandle<T> typeHandle, uint version) where T : IComponentData
```

### Parameters

**** (\[ComponentTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/componenttypehandle1)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetComponentTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getcomponenttypehandle.md). Pass the object to a job using a public field you define as part of the job struct.**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): The version to compare. In a system, this parameter should be set to the current [ComponentSystemBase.LastSystemVersion](/engine/7000.0/script-reference/unity/entities/componentsystembase/lastsystemversion.md) at the time the job is run or scheduled.

### Returns

| Type                                                          | Description                                                                                                                           |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the version number stored in the chunk for this component is more recent than the version passed to the `version` parameter. |

### 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 [EntityManager.GlobalSystemVersion](/engine/7000.0/script-reference/unity/entities/entitymanager/globalsystemversion.md) value. Since every system stores the global system version in its [ComponentSystemBase.LastSystemVersion](/engine/7000.0/script-reference/unity/entities/componentsystembase/lastsystemversion.md) 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, uint)

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.

```csharp
public readonly bool DidChange(ref DynamicComponentTypeHandle typeHandle, uint version)
```

### Parameters

**** (\[DynamicComponentTypeHandle]\(/engine/7000.0/script-reference/unity/entities/dynamiccomponenttypehandle)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetDynamicComponentTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getdynamiccomponenttypehandle.md). Pass the object to a job using a public field you define as part of the job struct.**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): The version to compare. In a system, this parameter should be set to the current [ComponentSystemBase.LastSystemVersion](/engine/7000.0/script-reference/unity/entities/componentsystembase/lastsystemversion.md) at the time the job is run or scheduled.

### Returns

| Type                                                          | Description                                                                                                                           |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the version number stored in the chunk for this component is more recent than the version passed to the `version` parameter. |

### 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 [EntityManager.GlobalSystemVersion](/engine/7000.0/script-reference/unity/entities/entitymanager/globalsystemversion.md) value. Since every system stores the global system version in its [ComponentSystemBase.LastSystemVersion](/engine/7000.0/script-reference/unity/entities/componentsystembase/lastsystemversion.md) 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>, uint)

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.

```csharp
public readonly bool DidChange<T>(ref BufferTypeHandle<T> bufferTypeHandle, uint version) where T : unmanaged, IBufferElementData
```

### Parameters

**** (\[BufferTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/buffertypehandle1)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetBufferTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getbuffertypehandle.md). Pass the object to a job using a public field you define as part of the job struct.**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): The version to compare. In a system, this parameter should be set to the current [ComponentSystemBase.LastSystemVersion](/engine/7000.0/script-reference/unity/entities/componentsystembase/lastsystemversion.md) at the time the job is run or scheduled.

### Returns

| Type                                                          | Description                                                                                                                           |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the version number stored in the chunk for this component is more recent than the version passed to the `version` parameter. |

### 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 [EntityManager.GlobalSystemVersion](/engine/7000.0/script-reference/unity/entities/entitymanager/globalsystemversion.md) value. Since every system stores the global system version in its [ComponentSystemBase.LastSystemVersion](/engine/7000.0/script-reference/unity/entities/componentsystembase/lastsystemversion.md) 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(TransformTypeHandle, uint)

Reports whether the [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) components in the chunk could have changed since the specified version.

```csharp
public readonly bool DidChange(ref TransformTypeHandle transformTypeHandle, uint version)
```

### Parameters

**** (\[TransformTypeHandle]\(/engine/7000.0/script-reference/unity/entities/transformtypehandle)): An object containing type and job safety information. To create this object, call [SystemState.GetTransformTypeHandle](/engine/7000.0/script-reference/unity/entities/systemstate/gettransformtypehandle.md). Pass the object to a job using a public field you define as part of the job struct.**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): The version to compare. In a system, this parameter should be set to the current [SystemState.LastSystemVersion](/engine/7000.0/script-reference/unity/entities/systemstate/lastsystemversion.md) at the time the job is run or scheduled.

### Returns

| Type                                                          | Description                                                                                                                                                                                           |
| ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the version number stored in the chunk for [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) is more recent than the version passed to the `version` parameter. |

### Remarks

When you access a transform in a chunk with write privileges, the ECS framework updates the change version of [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) to the current [EntityManager.GlobalSystemVersion](/engine/7000.0/script-reference/unity/entities/entitymanager/globalsystemversion.md) value. Since every system stores the global system version in its [SystemState.LastSystemVersion](/engine/7000.0/script-reference/unity/entities/systemstate/lastsystemversion.md) field when it updates, you can compare these two versions with this function in order to determine whether the transforms 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 [TransformRef](/engine/7000.0/script-reference/unity/entities/transformref.md) does not actually change any transform.

## DidChange\<T>(SharedComponentTypeHandle\<T>, uint)

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

```csharp
public readonly bool DidChange<T>(SharedComponentTypeHandle<T> chunkSharedComponentData, uint version) where T : struct, ISharedComponentData
```

### Parameters

**** (\[SharedComponentTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/sharedcomponenttypehandle1)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetSharedComponentTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getsharedcomponenttypehandle.md). Pass the object to a job using a public field you define as part of the job struct.**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): The version to compare. In a system, this parameter should be set to the current [ComponentSystemBase.LastSystemVersion](/engine/7000.0/script-reference/unity/entities/componentsystembase/lastsystemversion.md) at the time the job is run or scheduled.

### Returns

| Type                                                          | Description                                                                                                                |
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the version number stored in the chunk for this component is more recent than the version passed to the `version` |

### 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, uint)

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

```csharp
public readonly bool DidChange(ref DynamicSharedComponentTypeHandle typeHandle, uint version)
```

### Parameters

**** (\[DynamicSharedComponentTypeHandle]\(/engine/7000.0/script-reference/unity/entities/dynamicsharedcomponenttypehandle)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetDynamicSharedComponentTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getdynamicsharedcomponenttypehandle.md).**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): The version to compare. In a system, this parameter should be set to the current [ComponentSystemBase.LastSystemVersion](/engine/7000.0/script-reference/unity/entities/componentsystembase/lastsystemversion.md).

### Returns

| Type                                                          | Description                                                                                                                |
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True, if the version number stored in the chunk for this component is more recent than the version passed to the `version` |

### 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.
