Equals
Checks whether this key identifies the same asset as another.
Read time 1 minuteLast updated 17 days ago
Definition
- Type: Method
- Namespace: Unity.Localization.Providers
- Assembly: UnityEngine.LocalizationRuntimeModule
Equals(AssetKey)
Checks whether this key identifies the same asset as another.
public bool Equals(AssetKey other)
Parameters
The key to compare with this one.
Returns
Type | Description |
|---|---|
| bool | |
Remarks
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.
Compare two keys built for the same asset.
Examples
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.
public override bool Equals(object obj)
Parameters
The object to compare with this key.
Returns
Type | Description |
|---|---|
| bool | |
Remarks
Returns when is not an AssetKey. Otherwise, defers to AssetKey.Equals for value comparison.
falseobjCompare against a boxed key.
Examples
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 } }}