1
This commit is contained in:
19
Unity/Scripts/NameProvider/GetNameFromGameobject.cs
Normal file
19
Unity/Scripts/NameProvider/GetNameFromGameobject.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace BITKit
|
||||
{
|
||||
[System.Serializable]
|
||||
public class GetNameFromGameobject : IReference, INameProvider
|
||||
{
|
||||
public GameObject gameobject;
|
||||
public string Get()
|
||||
{
|
||||
return gameobject.name;
|
||||
}
|
||||
public string GetName(object obj, params object[] extensions)
|
||||
{
|
||||
return Get();
|
||||
}
|
||||
}
|
||||
}
|
23
Unity/Scripts/NameProvider/GetNameFromIDatabase.cs
Normal file
23
Unity/Scripts/NameProvider/GetNameFromIDatabase.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user