# Equals

> Checks whether this key identifies the same asset as another.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Localization.Providers](/engine/6000.7/script-reference/unity/localization/providers.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule

## Equals(AssetKey)

Checks whether this key identifies the same asset as another.

```csharp
public bool Equals(AssetKey other)
```

### Parameters

**** (\[AssetKey]\(/engine/6000.7/script-reference/unity/localization/providers/assetkey)): The key to compare with this one.

### Returns

| Type                                                          | Description                                                      |
| ------------------------------------------------------------- | ---------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if both keys identify the same asset; otherwise, `false`. |

### Remarks

Two keys are equal when their addresses match by ordinal comparison, their sub-asset names match by ordinal comparison, and their [AssetKey.Type](/engine/6000.7/script-reference/unity/localization/providers/assetkey/type.md) values are the same. Keys with the same address but a different type are not equal.

Compare two keys built for the same asset.

### Examples

```csharp
using Unity.Localization.Providers;
using UnityEngine;

namespace Unity.Localization.Samples
{
    public class AssetKeyEqualsExample
    {
        public void Run()
        {
            var a = new AssetKey("UI/Logo", typeof(Texture2D));
            var b = new AssetKey("UI/Logo", typeof(Texture2D));

            Debug.Log(a.Equals(b));   // True
        }
    }
}
```

## Equals(Object)

Checks whether this key equals another object.

```csharp
public override bool Equals(object obj)
```

### Parameters

**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): The object to compare with this key.

### Returns

| Type                                                          | Description                                                                  |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if `obj` is a key that identifies the same asset; otherwise, `false`. |

### Remarks

Returns `false` when `obj` is not an [AssetKey](/engine/6000.7/script-reference/unity/localization/providers/assetkey.md). Otherwise, defers to [AssetKey.Equals](/engine/6000.7/script-reference/unity/localization/providers/assetkey/equals.md) for value comparison.

Compare against a boxed key.

### Examples

```csharp
using Unity.Localization.Providers;
using UnityEngine;

namespace Unity.Localization.Samples
{
    public class AssetKeyEqualsObjectExample
    {
        public void Run()
        {
            var key = new AssetKey("UI/Logo", typeof(Texture2D));
            object boxed = new AssetKey("UI/Logo", typeof(Texture2D));

            Debug.Log(key.Equals(boxed));   // True
        }
    }
}
```
