Beispiel #1
0
        //...
        static void ProccessMessage(Logger.Message msg)
        {
            var graph = Graph.GetElementGraph(msg.context);

            if (graph != null)
            {
                var unityContext = graph.agent != null? (Object)graph.agent.gameObject : (Object)graph;
                Selection.activeObject = unityContext;
                EditorGUIUtility.PingObject(unityContext);
                var editor = GraphEditor.current;
                if (editor == null || GraphEditor.currentGraph != graph)
                {
                    editor = GraphEditor.OpenWindow(graph);
                }
                if (msg.context is Node)
                {
                    var node = (Node)msg.context;
                    EditorApplication.delayCall += () => GraphEditor.FocusNode(node);
                }
                if (msg.context is Connection)
                {
                    var connection = (Connection)msg.context;
                    EditorApplication.delayCall += () => GraphEditor.FocusConnection(connection);
                }
                if (msg.context is Task)
                {
                    var task   = (Task)msg.context;
                    var parent = graph.GetTaskParent(task);
                    if (parent != null)
                    {
                        EditorApplication.delayCall += () => GraphEditor.FocusNode(parent);
                    }
                }
            }
        }