BITFALL/Assets/BITKit/Unity/Scripts/Reference/ReferenceSO.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2023-06-08 14:09:50 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.UIElements;
#endif
namespace BITKit
{
[System.Serializable]
public class ReferenceSO : ScriptableObject
{
[TextArea]
public string value;
}
[System.Serializable]
public record ReferenceScriptableObject : References
{
public ReferenceSO so;
public override string Get() => so.value.IsNullOrEmpty() ? so.name : so.value;
}
2023-10-02 23:24:56 +08:00
// #if UNITY_EDITOR
// [CustomPropertyDrawer(typeof(ReferenceScriptableObject))]
// public class ReferenceScriptableObjectDrawer : BITProperty
// {
// public override VisualElement CreatePropertyGUI(SerializedProperty property)
// {
// VisualElement root = new();
// root.Add(base.CreatePropertyGUI(property));
//
// Button button = new();
// root.Add(button);
// return root;
// }
// public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
// {
// base.OnGUI(position, property, label);
// EditorGUI.PropertyField(position, property);
// EditorGUI.LinkButton(position, "New Button");
// }
// }
// #endif
2023-06-08 14:09:50 +08:00
}