38 lines
867 B
C#
38 lines
867 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEditor;
|
||
|
using UnityEditor.UIElements;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UIElements;
|
||
|
|
||
|
namespace BITKit
|
||
|
{
|
||
|
public class AssetCacheScriptableObject : ScriptableObject
|
||
|
{
|
||
|
[SerializeField] private bool isEditable;
|
||
|
[SerializeField] private Object[] _assets;
|
||
|
|
||
|
public bool IsEditable => isEditable;
|
||
|
public Object[] Assets => _assets;
|
||
|
}
|
||
|
#if UNITY_EDITOR
|
||
|
[CustomEditor(typeof(AssetCacheScriptableObject))]
|
||
|
public class AssetCacheScriptableObjectEditor : BITInspector<AssetCacheScriptableObject>
|
||
|
{
|
||
|
public override VisualElement CreateInspectorGUI()
|
||
|
{
|
||
|
if (agent.IsEditable)
|
||
|
{
|
||
|
return base.CreateInspectorGUI();
|
||
|
}
|
||
|
foreach (var x in agent.Assets)
|
||
|
{
|
||
|
var field = root.Create<PropertyField>();
|
||
|
field.Bind(new SerializedObject(x));
|
||
|
}
|
||
|
return root;
|
||
|
}
|
||
|
}
|
||
|
#endif
|
||
|
}
|