private void OpenGraphAsset(UnityObject unityObject, bool shouldSetSceneAsDirty) { shouldCloseWindow = true; ScriptGraphAsset scriptGraphAsset = unityObject as ScriptGraphAsset; GraphReference graphReference = null; if (scriptGraphAsset != null) { graphReference = GraphReference.New(scriptGraphAsset, true); } else { StateGraphAsset stateGraphAsset = unityObject as StateGraphAsset; if (stateGraphAsset != null) { graphReference = GraphReference.New(stateGraphAsset, true); } } if (shouldSetSceneAsDirty) { EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); } GraphWindow.OpenActive(graphReference); GUIUtility.ExitGUI(); }
private void DropAreaGUI() { Event currentEvent = Event.current; Rect activeArea = GUILayoutUtility.GetRect(0, 0, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); switch (currentEvent.type) { case EventType.DragUpdated: case EventType.DragPerform: if (!activeArea.Contains(currentEvent.mousePosition)) { return; } DragAndDrop.visualMode = DragAndDropVisualMode.Copy; if (currentEvent.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); foreach (UnityObject draggedObject in DragAndDrop.objectReferences) { ScriptGraphAsset scriptGraphAsset = draggedObject as ScriptGraphAsset; if (scriptGraphAsset != null) { shouldCloseWindow = true; GraphWindow.OpenActive(GraphReference.New(scriptGraphAsset, true)); break; } } } break; } }
private void OpenGraphAsset(UnityObject unityObject) { shouldCloseWindow = true; ScriptGraphAsset scriptGraphAsset = unityObject as ScriptGraphAsset; GraphReference graphReference = null; if (scriptGraphAsset != null) { graphReference = GraphReference.New(scriptGraphAsset, true); } else { StateGraphAsset stateGraphAsset = unityObject as StateGraphAsset; if (stateGraphAsset != null) { graphReference = GraphReference.New(stateGraphAsset, true); } } GraphWindow.OpenActive(graphReference); }