-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphDataAsset.cs
More file actions
38 lines (31 loc) · 1.05 KB
/
GraphDataAsset.cs
File metadata and controls
38 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using UnityEditor;
using UnityEngine;
using static UnityEngine.GraphicsBuffer;
namespace EventGraph
{
[CreateAssetMenu(fileName = "GraphData", menuName = "Graph Data", order = 1)]
public class GraphDataAsset : ScriptableObject
{
public GraphData graphData;
}
#if UNITY_EDITOR
[CustomEditor(typeof(GraphDataAsset))]
public class GraphDataAssetEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GraphDataAsset graphDataAsset = (GraphDataAsset)target;
if (GUILayout.Button("Save Graph Data"))
{
string path = EditorUtility.SaveFilePanelInProject("Save Graph Data", "New Graph Data", "asset", "Please enter a file name to save the graph data to");
if (!string.IsNullOrEmpty(path))
{
AssetDatabase.CreateAsset(graphDataAsset, path);
AssetDatabase.SaveAssets();
}
}
}
}
#endif
}