7502018d20
There is an asset in the store I grabbed. the coding is WAY above my head, I got about half of it and integrated and adapted what I can to it. im going as far as I can with it and ill come back in a few month when I understand t better.
52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
using System;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace UnityEngine.AddressableAssets
|
|
{
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
[Serializable]
|
|
public class AssetLabelReference : IKeyEvaluator
|
|
{
|
|
[FormerlySerializedAs("m_labelString")]
|
|
[SerializeField]
|
|
string m_LabelString;
|
|
/// <summary>
|
|
/// The label string.
|
|
/// </summary>
|
|
public string labelString
|
|
{
|
|
get { return m_LabelString; }
|
|
set { m_LabelString = value; }
|
|
}
|
|
/// <summary>
|
|
/// The runtime key used for indexing values in the Addressables system.
|
|
/// </summary>
|
|
public object RuntimeKey
|
|
{
|
|
get
|
|
{
|
|
if (labelString == null)
|
|
labelString = string.Empty;
|
|
return labelString;
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public bool RuntimeKeyIsValid()
|
|
{
|
|
return !string.IsNullOrEmpty(RuntimeKey.ToString());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the hash code of this object.
|
|
/// </summary>
|
|
/// <returns>The hash code of the label string.</returns>
|
|
public override int GetHashCode()
|
|
{
|
|
return labelString.GetHashCode();
|
|
}
|
|
}
|
|
}
|