Firstborn/Library/PackageCache/com.unity.addressables@1.19.19/Runtime/AssetLabelReference.cs
Schaken-Mods 7502018d20 Adding Mod Support
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.
2023-05-13 22:01:48 -05:00

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();
}
}
}