BITKit/Packages/Runtime/NameProvider/GetNameFromIDatabase.cs

23 lines
619 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit
{
[System.Serializable]
public class GetNameFromIDatabase : NameProvider
{
[SerializeReference, SubclassSelector] public References path;
public Object Object;
public override string GetName(object obj, params object[] extensions)
{
if (Object is IDatabase database)
{
return database.Get<string>(path);
}
else
{
throw new System.NullReferenceException();
}
}
}
}