| Parameter | Description |
|---|---|
| other | The key to compare with this one. |
bool
true if both keys identify the same asset; otherwise, false.
Checks whether this key identifies the same asset as another.
Two keys are equal when their addresses match by ordinal comparison, their sub-asset names match by ordinal
comparison, and their AssetKey.Type values are the same. Keys with the same address but a different type
are not equal.
<para>Compare two keys built for the same asset.</para>
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 } } }
| Parameter | Description |
|---|---|
| obj | The object to compare with this key. |
bool
true if obj is a key that identifies the same asset; otherwise, false.
Checks whether this key equals another object.
Returns false when obj is not an AssetKey. Otherwise, defers to
AssetKey.Equals for value comparison.
<para>Compare against a boxed key.</para>
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 } } }