# GetDirtyCount

> Returns an integer that indicates the number of times the specified object's serialized properties have changed.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.3/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

## GetDirtyCount(int)

Returns an integer that indicates the number of times the specified object's serialized properties have changed.

> **Warning:**
>
> **Deprecated.** GetDirtyCount(int) is deprecated. Use GetDirtyCount(EntityId) instead.

```csharp
public static int GetDirtyCount(int instanceID)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The object's instance ID.

### Returns

| Type                                                       | Description |
| ---------------------------------------------------------- | ----------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) |             |

### Remarks

This count is incremented each time a call to [EditorUtility.SetDirty](/engine/6000.3/script-reference/unityeditor/editorutility/setdirty.md) changes the object's serializable properties, and is reset to zero when the object is saved.

Additional Resources: [EditorUtility.IsDirty](/engine/6000.3/script-reference/unityeditor/editorutility/isdirty.md), [EditorUtility.SetDirty](/engine/6000.3/script-reference/unityeditor/editorutility/setdirty.md).

## GetDirtyCount(EntityId)

Returns an integer that indicates the number of times the specified object's serialized properties have changed.

```csharp
public static int GetDirtyCount(EntityId entityId)
```

### Parameters

**** (\[EntityId]\(/engine/6000.3/script-reference/unityengine/entityid)):&#x20;

### Returns

| Type                                                       | Description |
| ---------------------------------------------------------- | ----------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) |             |

### Remarks

This count is incremented each time a call to [EditorUtility.SetDirty](/engine/6000.3/script-reference/unityeditor/editorutility/setdirty.md) changes the object's serializable properties, and is reset to zero when the object is saved.

Additional Resources: [EditorUtility.IsDirty](/engine/6000.3/script-reference/unityeditor/editorutility/isdirty.md), [EditorUtility.SetDirty](/engine/6000.3/script-reference/unityeditor/editorutility/setdirty.md).

## GetDirtyCount(Object)

Returns an integer that indicates the number of times the specified object's serialized properties have changed.

```csharp
public static int GetDirtyCount(Object target)
```

### Parameters

**** (\[Object]\(/engine/6000.3/script-reference/unityengine/object)): The object.

### Returns

| Type                                                       | Description |
| ---------------------------------------------------------- | ----------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) |             |

### Remarks

This count is incremented each time a call to [EditorUtility.SetDirty](/engine/6000.3/script-reference/unityeditor/editorutility/setdirty.md) changes the object's serializable properties, and is reset to zero when the object is saved.

Additional Resources: [EditorUtility.IsDirty](/engine/6000.3/script-reference/unityeditor/editorutility/isdirty.md), [EditorUtility.SetDirty](/engine/6000.3/script-reference/unityeditor/editorutility/setdirty.md).
