public void OnWizardCreate() { if (!Directory.Exists(Application.dataPath + "/Code Graph")) { AssetDatabase.CreateFolder("Assets", "Code Graph"); } var graph = new GraphFile(GraphName, GeneratedMonoBehaviourName, new List <GraphFileNode>(), new List <GraphFileConnection>()); GraphFileSaveManager.SaveGraphFile(graph); }
public static bool OnOpenAsset(int instanceID, int line) { string assetPath = AssetDatabase.GetAssetPath(instanceID); var graph = GraphFileSaveManager.LoadGraphFile(assetPath.Substring(assetPath.LastIndexOf('/') + 1)); if (graph != null) { var window = EditorWindow.GetWindow <GraphEditorWindow>(); window.SetGraph(graph); window.Init(); return(true); } return(false); //let unity open it. }
private void DrawNonZoomArea() { Handles.DrawSolidRectangleWithOutline(new Rect(0, topPanelHeight, leftPanelWidth, position.height - topPanelHeight), new Color(0.13f, 0.13f, 0.13f), Color.clear); Handles.DrawSolidRectangleWithOutline(new Rect(0, 0, position.width, topPanelHeight), new Color(0.13f, 0.13f, 0.13f), Color.clear); Handles.color = new Color(0.2f, 0.2f, 0.2f); Handles.DrawDottedLine(new Vector3(0f, topPanelHeight), new Vector3(position.width, topPanelHeight), 2f); Handles.DrawDottedLine(new Vector3(leftPanelWidth, topPanelHeight), new Vector3(leftPanelWidth, position.height), 2f); if (GUI.Button(new Rect(0f, 0f, 100f, 32f), "Save Asset")) { GraphFileSaveManager.SaveGraphFile(CurrentGraph); AssetDatabase.Refresh(); } GUI.Button(new Rect(100f, 0f, 100f, 32f), "Compile Asset"); // GUI.Box(new Rect(0.0f, 20.0f, 600.0f, 50.0f), "Adjust zoom of middle box with slider or mouse wheel.\nMove zoom area dragging with middle mouse button or Alt+left mouse button."); GUI.Label(new Rect(216f, 0, 600f, 32f), $"Size: {position.size} - Mouse: {Event.current.mousePosition}"); if (showNodeCreator) { newNodeWindow.Render(); } }