# CompareTo(GlobalObjectId)

> Compares this unique object identifier with another to determine their relative positions in the sort order.

## Definition

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

```csharp
public int CompareTo(GlobalObjectId other)
```

### Parameters

**** (\[GlobalObjectId]\(/engine/6000.6/script-reference/unityeditor/globalobjectid)): The other GlobalObjectId to compare with this instance.

### Returns

| Type                                                       | Description                                                                                                                                                                                                                                                                                                                                 |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | Returns an integer that represents the relative sort order positions of the current instance and the other `GlobalObjectId`. Returns a negative integer if this instance precedes `other`. Returns a positive integer if this instance follows `other`. Returns zero if this instance and `other` have the same position in the sort order. |

### Remarks

The sort order for comparison is [GlobalObjectId.assetGUID](/engine/6000.6/script-reference/unityeditor/globalobjectid/assetguid.md), [GlobalObjectId.targetObjectId](/engine/6000.6/script-reference/unityeditor/globalobjectid/targetobjectid.md), [GlobalObjectId.targetPrefabId](/engine/6000.6/script-reference/unityeditor/globalobjectid/targetprefabid.md), then [GlobalObjectId.identifierType](/engine/6000.6/script-reference/unityeditor/globalobjectid/identifiertype.md).

**Note**: To check if two instances of `GlobalObjectId` are equivalent, use [GlobalObjectId.Equals](/engine/6000.6/script-reference/unityeditor/globalobjectid/equals.md) instead.
