# CalculateDifference(EntityArchetype, EntityArchetype, TypeIndex*, out int, TypeIndex*, out int)

> Calculates the difference between two archetypes. Reports what components need to be added to and removed from "before" in order to convert it to "after".

## Definition

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

## CalculateDifference(EntityArchetype, EntityArchetype, TypeIndex\*, int, TypeIndex\*, int)

```csharp
public static void CalculateDifference(EntityArchetype before, EntityArchetype after, TypeIndex* addedTypes, out int addedTypesCount, TypeIndex* removedTypes, out int removedTypesCount)
```

### Parameters

**** (\[EntityArchetype]\(/engine/7000.0/script-reference/unity/entities/entityarchetype)): First archetype**** (\[EntityArchetype]\(/engine/7000.0/script-reference/unity/entities/entityarchetype)): Second archetype**** (\[TypeIndex\*]\(/engine/7000.0/script-reference/unity/entities/typeindex)): Buffer to hold type indices of types present in "after" but not in "before".  Buffer must be large enough to potentially hold all the types present in "after"**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): How many types were put into the addedTypes buffer**** (\[TypeIndex\*]\(/engine/7000.0/script-reference/unity/entities/typeindex)): Buffer to hold type indices of types present in "before" but not in "after".  Buffer must be large enough to potentially hold all the types present in "before"**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): How many types were put into the removedTypes buffer
