using System;
using UnityEngine.Serialization;
namespace UnityEngine.AddressableAssets
{
///
/// Reference to an asset label. This class can be used in scripts as a field and will use a CustomPropertyDrawer to provide a DropDown UI of available labels.
///
[Serializable]
public class AssetLabelReference : IKeyEvaluator
{
[FormerlySerializedAs("m_labelString")]
[SerializeField]
string m_LabelString;
///
/// The label string.
///
public string labelString
{
get { return m_LabelString; }
set { m_LabelString = value; }
}
///
/// The runtime key used for indexing values in the Addressables system.
///
public object RuntimeKey
{
get
{
if (labelString == null)
labelString = string.Empty;
return labelString;
}
}
///
public bool RuntimeKeyIsValid()
{
return !string.IsNullOrEmpty(RuntimeKey.ToString());
}
///
/// Get the hash code of this object.
///
/// The hash code of the label string.
public override int GetHashCode()
{
return labelString.GetHashCode();
}
}
}