Skip to content

Commit 79bf063

Browse files
committed
Added graph behavior example (graph that lives in a monobehavior)
1 parent 921b372 commit 79bf063

File tree

9 files changed

+899
-1239
lines changed

9 files changed

+899
-1239
lines changed

Assets/Examples/BasicExample.asset

Lines changed: 110 additions & 1191 deletions
Large diffs are not rendered by default.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
using UnityEngine.UIElements;
4+
5+
[CustomEditor(typeof(GraphBehaviour))]
6+
public class GraphBehaviourEditor : Editor
7+
{
8+
Editor graphEditor;
9+
GraphBehaviour behaviour => target as GraphBehaviour;
10+
11+
void OnEnable()
12+
{
13+
graphEditor = Editor.CreateEditor(behaviour.graph);
14+
}
15+
16+
void OnDisable()
17+
{
18+
DestroyImmediate(graphEditor);
19+
}
20+
21+
public override VisualElement CreateInspectorGUI()
22+
{
23+
var root = new VisualElement();
24+
var graphContainer = graphEditor.CreateInspectorGUI().Q("ExposedParameters");
25+
26+
root.Add(new Button(() => EditorWindow.GetWindow<AllGraphWindow>().InitializeGraph(behaviour.graph))
27+
{
28+
text = "Open"
29+
});
30+
31+
root.Add(graphContainer);
32+
33+
return root;
34+
}
35+
}

Assets/Examples/Editor/GraphBehaviourEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)