37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
using UnityEditor;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
[CustomEditor(typeof(NanoBrain))]
|
|
public class NanoBrainComponent_Editor : Editor {
|
|
protected static VisualElement mainContainer;
|
|
protected static VisualElement inspectorContainer;
|
|
|
|
protected NanoBrain component;
|
|
private SerializedProperty brainProp;
|
|
|
|
ClusterInspector.GraphView board;
|
|
|
|
public void OnEnable() {
|
|
component = target as NanoBrain;
|
|
|
|
if (Application.isPlaying == false)
|
|
brainProp = serializedObject.FindProperty(nameof(NanoBrain.defaultBrain));
|
|
}
|
|
|
|
public override VisualElement CreateInspectorGUI() {
|
|
Cluster brain = component.brain;
|
|
|
|
if (Application.isPlaying == false)
|
|
serializedObject.Update();
|
|
|
|
|
|
VisualElement root = new();
|
|
ClusterInspector.CreateInspector(root, brain.prefab, brain.output, component.gameObject);
|
|
|
|
if (Application.isPlaying == false)
|
|
serializedObject.ApplyModifiedProperties();
|
|
return root;
|
|
}
|
|
|
|
} |