コード例 #1
0
        void PopupClick(MouseUpEvent mouseEvent)
        {
            var filter = config.filter;

            if (filter.OnlyGetType && filter.CanManipulateArray())
            {
                TypeSelectorWindow.ShowWindow(Vector2.zero, filter, delegate(MemberData[] types) {
                    uNodeEditorUtility.RegisterUndo(config.owner.targetNode);
                    member.CopyFrom(types[0]);
                    config.OnValueChanged(member);
                    config.owner.OnValueChanged();
                    UpdateControl();
                    config.owner.MarkRepaint();
                }, new TypeItem[1] {
                    member
                }).ChangePosition(GUIUtility.GUIToScreenPoint(mouseEvent.mousePosition)).targetObject = config.owner.targetNode;
            }
            else
            {
                ItemSelector.ShowWindow(config.owner.targetNode, member, filter, (m) => {
                    m.ResetCache();
                    config.OnValueChanged(member);
                    config.owner.OnValueChanged();
                    UpdateControl();
                    config.owner.MarkRepaint();
                }).ChangePosition(GUIUtility.GUIToScreenPoint(mouseEvent.mousePosition));
            }
        }
コード例 #2
0
        void OnClick(MouseUpEvent mouseDownEvent)
        {
            var val  = config.value;
            var mPos = mouseDownEvent.mousePosition;

            if (UnityEditor.EditorWindow.focusedWindow != null)
            {
                mPos = (mouseDownEvent.currentTarget as VisualElement).GetScreenMousePosition(
                    mouseDownEvent.localMousePosition,
                    UnityEditor.EditorWindow.focusedWindow);
            }
            if (config.filter.OnlyGetType)
            {
                if (config.filter.CanManipulateArray())
                {
                    TypeSelectorWindow.ShowWindow(Vector2.zero, config.filter, delegate(MemberData[] types) {
                        config.value = types[0];
                        config.OnValueChanged(config.value);
                        config.owner.OnValueChanged();
                        config.owner.MarkRepaint();
                    }, new TypeItem[1] {
                        val as MemberData
                    }).ChangePosition(mPos);
                }
                else
                {
                    ItemSelector.ShowWindow(null, val as MemberData, config.filter, (m) => {
                        config.value = m;
                        config.OnValueChanged(m);
                        config.owner.OnValueChanged();
                        config.owner.MarkRepaint();
                    }).ChangePosition(mPos);
                }
            }
            else
            {
                ActionPopupWindow.ShowWindow(Vector2.zero, () => {
                    uNodeGUIUtility.EditValueLayouted(GUIContent.none, val, config.type, (obj) => {
                        config.owner.RegisterUndo();
                        val = obj;
                        config.OnValueChanged(obj);
                        config.owner.MarkRepaint();
                    }, new uNodeUtility.EditValueSettings()
                    {
                        attributes  = new object[] { config.filter },
                        unityObject = config.owner.targetNode
                    });
                }, 300, 300).ChangePosition(mPos);
            }
        }
コード例 #3
0
ファイル: NodeGraph.cs プロジェクト: hagusen/AI-Testing
        public void ShowNodeMenu(Vector2 position, FilterAttribute filter = null, Action <Node> onAddNode = null, bool flowNodes = true)
        {
            var valueMenuPos = GetMenuPosition();

            if (filter == null)
            {
                filter = new FilterAttribute();
                //filter.CanSelectType = true;
                //filter.HideTypes.Add(typeof(void));
            }
            else
            {
                filter = new FilterAttribute(filter);
            }
            filter.DisplayInstanceOnStatic = true;
            filter.MaxMethodParam          = int.MaxValue;
            filter.Public   = true;
            filter.Instance = true;
            if (flowNodes)
            {
                filter.VoidType = true;
            }
            ItemSelector w = ItemSelector.ShowWindow(editorData.selectedGroup ?? editorData.selectedRoot as UnityEngine.Object ?? editorData.graph, new MemberData(editorData.selectedGroup ?? editorData.selectedRoot as UnityEngine.Object ?? editorData.graph, MemberData.TargetType.SelfTarget), filter, delegate(MemberData value) {
                NodeEditorUtility.AddNewNode <MultipurposeNode>(editorData, null, null, position, delegate(MultipurposeNode n) {
                    if (n.target == null)
                    {
                        n.target = new MultipurposeMember();
                    }
                    n.target.target = value;
                    MemberDataUtility.UpdateMultipurposeMember(n.target);
                    if (onAddNode != null)
                    {
                        onAddNode(n);
                    }
                    Refresh();
                });
            }).ChangePosition(valueMenuPos);

            w.displayNoneOption     = false;
            w.displayCustomVariable = false;
            if (filter.SetMember)
            {
                return;                //Return on set member is true.
            }
            List <ItemSelector.CustomItem> customItems = new List <ItemSelector.CustomItem>();

            foreach (NodeMenu menuItem in NodeEditorUtility.FindNodeMenu())
            {
                if (filter.OnlyGetType && menuItem.type != typeof(Type))
                {
                    continue;
                }
                bool isFlowNode = !menuItem.type.IsSubclassOf(typeof(ValueNode));
                if (editorData.selectedRoot && menuItem.HideOnFlow || !flowNodes && isFlowNode)
                {
                    continue;
                }
                if (isFlowNode && filter.SetMember || !filter.IsValidTarget(MemberData.TargetType.FlowNode))
                {
                    continue;
                }
                if (!isFlowNode && !filter.IsValidTarget(MemberData.TargetType.ValueNode))
                {
                    continue;
                }
                if (editorData.selectedGroup && (menuItem.HideOnGroup))
                {
                    continue;
                }
                if (menuItem.HideOnStateMachine && !editorData.selectedRoot && !editorData.selectedGroup)
                {
                    continue;
                }
                if (menuItem.returnType != null && menuItem.returnType != typeof(object) && !filter.IsValidType(menuItem.returnType))
                {
                    continue;
                }
                if (menuItem.IsCoroutine && !editorData.supportCoroutine)
                {
                    continue;
                }
                customItems.Add(new ItemSelector.CustomItem(menuItem.name, delegate() {
                    NodeEditorUtility.AddNewNode <Node>(editorData, menuItem.name.Split(' ')[0], menuItem.type, position, onAddNode);
                    Refresh();
                }, menuItem.category.Replace("/", "."))
                {
                    icon    = isFlowNode ? uNodeEditorUtility.GetTypeIcon(typeof(TypeIcons.FlowIcon)) : null,
                    tooltip = new GUIContent(menuItem.tooltip),
                });
            }
            #region Flow
            if (flowNodes && !filter.SetMember && filter.IsValidType(typeof(void)))
            {
                if (!(!editorData.selectedRoot && !editorData.selectedGroup))
                {
                    customItems.Add(new ItemSelector.CustomItem("Continue", delegate() {
                        NodeEditorUtility.AddNewNode <NodeJumpStatement>(
                            editorData,
                            "Continue",
                            position,
                            delegate(NodeJumpStatement n) {
                            n.statementType = JumpStatementType.Continue;
                        });
                        Refresh();
                    }, "JumpStatement")
                    {
                        icon = uNodeEditorUtility.GetTypeIcon(typeof(TypeIcons.FlowIcon)),
                    });
                    customItems.Add(new ItemSelector.CustomItem("Break", delegate() {
                        NodeEditorUtility.AddNewNode <NodeJumpStatement>(
                            editorData,
                            "Break",
                            position,
                            delegate(NodeJumpStatement n) {
                            n.statementType = JumpStatementType.Break;
                        });
                        Refresh();
                    }, "JumpStatement")
                    {
                        icon = uNodeEditorUtility.GetTypeIcon(typeof(TypeIcons.FlowIcon)),
                    });
                }
                if (editorData.selectedRoot)
                {
                    customItems.Add(new ItemSelector.CustomItem("Return", delegate() {
                        NodeEditorUtility.AddNewNode <NodeReturn>(
                            editorData,
                            "Return",
                            position,
                            delegate(NodeReturn n) {
                        });
                        Refresh();
                    }, "Return")
                    {
                        icon = uNodeEditorUtility.GetTypeIcon(typeof(TypeIcons.FlowIcon)),
                    });
                }
            }
            #endregion
            if (filter.IsValidTarget(MemberData.TargetType.ValueNode))
            {
                if (filter.IsValidType(typeof(Type)))
                {
                    customItems.Add(new ItemSelector.CustomItem("typeof()", delegate() {
                        var win = TypeSelectorWindow.ShowWindow(Vector2.zero, new FilterAttribute()
                        {
                            OnlyGetType = true, DisplayRuntimeType = false
                        }, delegate(MemberData[] types) {
                            NodeEditorUtility.AddNewNode <MultipurposeNode>(
                                editorData,
                                position,
                                delegate(MultipurposeNode n) {
                                if (n.target == null)
                                {
                                    n.target = new MultipurposeMember();
                                }
                                n.target.target = types[0];
                                if (onAddNode != null)
                                {
                                    onAddNode(n);
                                }
                                Refresh();
                            });
                        });
                        win.targetObject = editorData.selectedGroup ?? editorData.selectedRoot as UnityEngine.Object ?? editorData.graph;
                        win.ChangePosition(valueMenuPos);
                    }, "Data"));
                }
                var nodeMenuItems = NodeEditorUtility.FindCreateNodeCommands();
                foreach (var n in nodeMenuItems)
                {
                    n.graph  = this;
                    n.filter = filter;
                    if (!n.IsValid())
                    {
                        continue;
                    }
                    customItems.Add(new ItemSelector.CustomItem(n.name, () => {
                        var createdNode = n.Setup(position);
                        if (onAddNode != null)
                        {
                            onAddNode(createdNode);
                        }
                    }, n.category)
                    {
                        icon = uNodeEditorUtility.GetTypeIcon(n.icon),
                    });
                }
            }
            w.customItems = customItems;
        }
コード例 #4
0
        public static void ShowAddEventMenu(
            Vector2 position,
            Object instance,
            Action <Block> addConditionEvent = null)
        {
            List <ItemSelector.CustomItem> customItems = new List <ItemSelector.CustomItem>();
            var conditions = GetConditionMenus();

            foreach (var c in conditions)
            {
                var type = c.type;
                customItems.Add(new ItemSelector.CustomItem(c.name,
                                                            delegate() {
                    if (addConditionEvent != null)
                    {
                        Block act;
                        if (type.IsSubclassOf(typeof(Block)))
                        {
                            act = ReflectionUtils.CreateInstance(type) as Block;
                        }
                        else if (type.IsCastableTo(typeof(IDataNode <bool>)))
                        {
                            act = new HLCondition()
                            {
                                type = MemberData.CreateFromType(type)
                            };
                        }
                        else
                        {
                            throw new Exception("The type must inherith from Block or IDataNode<bool>");
                        }
                        addConditionEvent(act);
                    }
                }, c.category));
            }
            ItemSelector.SortCustomItems(customItems);
            FilterAttribute filter = new FilterAttribute()
            {
                InvalidTargetType = MemberData.TargetType.Values | MemberData.TargetType.Null,
                MaxMethodParam    = int.MaxValue,
                Instance          = true,
                VoidType          = false,
            };
            ItemSelector w = ItemSelector.ShowWindow(instance, filter, (member) => {
                if (instance != null && !member.isStatic)
                {
                    Type startType = member.startType;
                    if (startType != null && member.instance == null)
                    {
                        if (instance.GetType().IsCastableTo(startType))
                        {
                            member.instance = instance;
                        }
                        else if (member.IsTargetingUNode)
                        {
                            if (member.instance == null)
                            {
                                member.instance = instance;
                            }
                        }
                        else if (instance is Component)
                        {
                            if (startType == typeof(GameObject))
                            {
                                member.instance = (instance as Component).gameObject;
                            }
                            else if (startType.IsSubclassOf(typeof(Component)))
                            {
                                member.instance = (instance as Component).GetComponent(startType);
                            }
                        }
                        else if (instance is GameObject)
                        {
                            if (startType == typeof(GameObject))
                            {
                                member.instance = instance as GameObject;
                            }
                            else if (startType.IsSubclassOf(typeof(Component)))
                            {
                                member.instance = (instance as GameObject).GetComponent(startType);
                            }
                        }
                        if (member.instance == null && ReflectionUtils.CanCreateInstance(startType))
                        {
                            member.instance = ReflectionUtils.CreateInstance(startType);
                        }
                    }
                    if (member.instance == null)
                    {
                        member.instance = MemberData.none;
                    }
                }
                Condition condition        = null;
                System.Action addCondition = () => {
                    if (addConditionEvent != null)
                    {
                        addConditionEvent(condition);
                    }
                };
                switch (member.targetType)
                {
                case MemberData.TargetType.Constructor:
                case MemberData.TargetType.Method: {
                    GenericMenu menu = new GenericMenu();
                    if (member.type == typeof(bool))
                    {
                        menu.AddItem(new GUIContent("Compare Return Value"), false, () => {
                                condition = onAddCompareValue(member);
                                addCondition();
                            });
                    }
                    menu.AddItem(new GUIContent("Equality Compare"), false, () => {
                            condition = onAddEqualityComparer(member);
                            addCondition();
                        });
                    menu.AddItem(new GUIContent("Is Compare"), false, () => {
                            condition = onAddIsComparer(member);
                            addCondition();
                        });
                    menu.ShowAsContext();
                    break;
                }

                case MemberData.TargetType.Field:
                case MemberData.TargetType.Property:
                case MemberData.TargetType.uNodeVariable:
                case MemberData.TargetType.uNodeProperty:
                case MemberData.TargetType.uNodeLocalVariable:
                case MemberData.TargetType.uNodeGroupVariable: {
                    GenericMenu menu = new GenericMenu();
                    if (member.type == typeof(bool))
                    {
                        menu.AddItem(new GUIContent("Compare Return Value"), false, () => {
                                condition = onAddCompareValue(member);
                                addCondition();
                            });
                    }
                    menu.AddItem(new GUIContent("Equality Compare"), false, () => {
                            condition = onAddEqualityComparer(member);
                            addCondition();
                        });
                    menu.AddItem(new GUIContent("Is Compare"), false, () => {
                            condition = onAddIsComparer(member);
                            addCondition();
                        });
                    menu.ShowAsContext();
                    break;
                }

                default:
                    condition = onAddCompareValue(member);
                    addCondition();
                    break;
                }
            }, false, customItems).ChangePosition(position);

            w.displayNoneOption     = false;
            w.displayCustomVariable = false;
            w.customItems           = customItems;
        }
コード例 #5
0
        public static void ShowAddActionMenu(Vector2 position, Action <Events.Action> action, UnityEngine.Object instance, bool acceptCoroutine = false)
        {
            List <ItemSelector.CustomItem> customItems = new List <ItemSelector.CustomItem>();
            var actions = GetActionMenus(acceptCoroutine);

            foreach (var a in actions)
            {
                var type = a.type;
                customItems.Add(new ItemSelector.CustomItem(a.name,
                                                            delegate() {
                    Events.Action act;
                    if (type.IsSubclassOf(typeof(Events.Action)))
                    {
                        act = ReflectionUtils.CreateInstance(type) as Events.Action;
                    }
                    else
                    {
                        act = new HLAction()
                        {
                            type = MemberData.CreateFromType(type)
                        };
                    }
                    action(act);
                }, a.category));
            }
            ItemSelector.SortCustomItems(customItems);
            FilterAttribute filter = new FilterAttribute()
            {
                InvalidTargetType = MemberData.TargetType.Values |
                                    MemberData.TargetType.Null |
                                    //MemberData.TargetType.Constructor |
                                    MemberData.TargetType.SelfTarget,
                MaxMethodParam = int.MaxValue,
                Instance       = true,
                VoidType       = true
            };
            ItemSelector w = ItemSelector.ShowWindow(instance, filter, (member) => {
                if (!(member.instance is UnityEngine.Object) && instance != null && !member.isStatic)
                {
                    Type startType = member.startType;
                    if (startType != null && member.instance == null)
                    {
                        if (instance.GetType().IsCastableTo(startType))
                        {
                            member.instance = instance;
                        }
                        else if (member.IsTargetingUNode)
                        {
                            if (member.instance == null)
                            {
                                member.instance = instance;
                            }
                        }
                        else if (instance is Component)
                        {
                            if (startType == typeof(GameObject))
                            {
                                member.instance = (instance as Component).gameObject;
                            }
                            else if (startType.IsSubclassOf(typeof(Component)))
                            {
                                member.instance = (instance as Component).GetComponent(startType);
                            }
                        }
                        else if (instance is GameObject)
                        {
                            if (startType == typeof(GameObject))
                            {
                                member.instance = instance as GameObject;
                            }
                            else if (startType.IsSubclassOf(typeof(Component)))
                            {
                                member.instance = (instance as GameObject).GetComponent(startType);
                            }
                        }
                        if (member.instance == null && ReflectionUtils.CanCreateInstance(startType))
                        {
                            member.instance = ReflectionUtils.CreateInstance(startType);
                        }
                    }
                    if (member.instance == null)
                    {
                        member.instance = MemberData.none;
                    }
                }
                switch (member.targetType)
                {
                case MemberData.TargetType.uNodeFunction:
                case MemberData.TargetType.Constructor:
                case MemberData.TargetType.Method: {
                    if (member.type != typeof(void))
                    {
                        GenericMenu menu = new GenericMenu();
                        menu.AddItem(new GUIContent("Invoke"), false, () => {
                                action(onAddGetAction(member));
                            });
                        menu.AddItem(new GUIContent("Compare"), false, () => {
                                action(onAddCompareAction(member));
                            });
                        menu.ShowAsContext();
                    }
                    else
                    {
                        action(onAddGetAction(member));
                    }
                    break;
                }

                case MemberData.TargetType.Field:
                case MemberData.TargetType.Property:
                case MemberData.TargetType.uNodeProperty:
                case MemberData.TargetType.uNodeVariable:
                case MemberData.TargetType.uNodeLocalVariable:
                case MemberData.TargetType.uNodeGroupVariable:
                case MemberData.TargetType.uNodeParameter: {
                    GenericMenu menu = new GenericMenu();
                    var members      = member.GetMembers();
                    if (members == null || members[members.Length - 1] == null || ReflectionUtils.CanGetMember(members[members.Length - 1]))
                    {
                        menu.AddItem(new GUIContent("Get"), false, () => {
                                action(onAddGetAction(member));
                            });
                    }
                    if (members == null || members[members.Length - 1] == null || ReflectionUtils.CanSetMember(members[members.Length - 1]))
                    {
                        menu.AddItem(new GUIContent("Set"), false, () => {
                                action(onAddSetAction(member));
                            });
                    }
                    menu.AddItem(new GUIContent("Compare"), false, () => {
                            action(onAddCompareAction(member));
                        });
                    menu.ShowAsContext();
                    break;
                }

                default:
                    throw new Exception("Unsupported target kind:" + member.targetType);
                }
            }, false, customItems).ChangePosition(position);

            w.displayNoneOption     = false;
            w.displayCustomVariable = false;
            w.customItems           = customItems;
        }
コード例 #6
0
ファイル: CustomEditor.cs プロジェクト: hagusen/AI-Testing
        public override void OnInspectorGUI()
        {
            MultiArithmeticNode node = target as MultiArithmeticNode;

            DrawDefaultInspector();
            VariableEditorUtility.DrawMembers(new GUIContent("Targets"), node.targets, node, new FilterAttribute(typeof(object)),
                                              (obj) => {
                node.targets = obj;
            },
                                              () => {
                uNodeEditorUtility.RegisterUndo(node);
                var type = node.ReturnType();
                if (type != typeof(object) && ReflectionUtils.CanCreateInstance(type))
                {
                    node.targets.Add(new MemberData(ReflectionUtils.CreateInstance(type)));
                }
                else if (node.targets.Count > 0)
                {
                    node.targets.Add(new MemberData(node.targets[node.targets.Count - 1]));
                }
                else
                {
                    node.targets.Add(new MemberData());
                }
            });
            if (GUILayout.Button(new GUIContent("Change Operator")))
            {
                var customItems = new List <ItemSelector.CustomItem>();
                {                //Primitives
                    customItems.AddRange(GetCustomItemForPrimitives(node, typeof(int)));
                    customItems.AddRange(GetCustomItemForPrimitives(node, typeof(float)));
                }
                var ns                 = NodeGraph.GetOpenedGraphUsingNamespaces();
                var preference         = uNodePreference.GetPreference();
                var assemblies         = EditorReflectionUtility.GetAssemblies();
                var includedAssemblies = uNodePreference.GetIncludedAssemblies();
                foreach (var assembly in assemblies)
                {
                    if (!includedAssemblies.Contains(assembly.GetName().Name))
                    {
                        continue;
                    }
                    var operators = EditorReflectionUtility.GetOperators(assembly, (op) => {
                        return(ns == null || ns.Contains(op.DeclaringType.Namespace));
                    });
                    if (operators.Count > 0)
                    {
                        foreach (var op in operators)
                        {
                            switch (op.Name)
                            {
                            case "op_Addition": {
                                var parameters = op.GetParameters();
                                customItems.Add(GetCustomItem(node, parameters[0].ParameterType, parameters[1].ParameterType, op.DeclaringType, op.ReturnType, ArithmeticType.Add));
                                break;
                            }

                            case "op_Subtraction": {
                                var parameters = op.GetParameters();
                                customItems.Add(GetCustomItem(node, parameters[0].ParameterType, parameters[1].ParameterType, op.DeclaringType, op.ReturnType, ArithmeticType.Subtract));
                                break;
                            }

                            case "op_Division": {
                                var parameters = op.GetParameters();
                                customItems.Add(GetCustomItem(node, parameters[0].ParameterType, parameters[1].ParameterType, op.DeclaringType, op.ReturnType, ArithmeticType.Divide));
                                break;
                            }

                            case "op_Multiply": {
                                var parameters = op.GetParameters();
                                customItems.Add(GetCustomItem(node, parameters[0].ParameterType, parameters[1].ParameterType, op.DeclaringType, op.ReturnType, ArithmeticType.Multiply));
                                break;
                            }

                            case "op_Modulus": {
                                var parameters = op.GetParameters();
                                customItems.Add(GetCustomItem(node, parameters[0].ParameterType, parameters[1].ParameterType, op.DeclaringType, op.ReturnType, ArithmeticType.Modulo));
                                break;
                            }
                            }
                        }
                    }
                }
                customItems.Sort((x, y) => {
                    if (x.category == y.category)
                    {
                        return(string.Compare(x.name, y.name));
                    }
                    return(string.Compare(x.category, y.category));
                });
                if (customItems.Count > 0)
                {
                    ItemSelector.ShowWindow(null, null, null, false, customItems).
                    ChangePosition(
                        GUIUtility.GUIToScreenRect(GUILayoutUtility.GetLastRect())
                        ).displayDefaultItem = false;
                }
            }
        }
コード例 #7
0
ファイル: CustomEditor.cs プロジェクト: hagusen/AI-Testing
        public override void OnInspectorGUI()
        {
            uNodeAssetInstance script = target as uNodeAssetInstance;

            serializedObject.UpdateIfRequiredOrScript();
            var position = uNodeGUIUtility.GetRect();
            var bPos     = position;

            bPos.x    += position.width - 20;
            bPos.width = 20;
            if (GUI.Button(bPos, "", EditorStyles.label))
            {
                var items = ItemSelector.MakeCustomItemsForInstancedType(new System.Type[] { typeof(uNodeClassAsset) }, (val) => {
                    script.target = val as uNodeClassAsset;
                    uNodeEditorUtility.MarkDirty(script);
                }, uNodeEditorUtility.IsSceneObject(script));
                ItemSelector.ShowWindow(null, null, null, null, items).ChangePosition(bPos.ToScreenRect()).displayDefaultItem = false;
                Event.current.Use();
            }
            EditorGUI.PropertyField(position, serializedObject.FindProperty(nameof(script.target)), new GUIContent("Graph", "The target graph reference"));
            serializedObject.ApplyModifiedProperties();
            if (script.target != null)
            {
                if (!Application.isPlaying || script.runtimeAsset == null)
                {
                    EditorGUI.BeginChangeCheck();
                    VariableEditorUtility.DrawLinkedVariables(script, script.target, "");
                    if (EditorGUI.EndChangeCheck())
                    {
                        uNodeEditorUtility.MarkDirty(script);
                    }
                }
                else if (script.runtimeAsset != null)
                {
                    Editor editor = Editor.CreateEditor(script.runtimeAsset);
                    if (editor != null)
                    {
                        EditorGUI.DropShadowLabel(uNodeGUIUtility.GetRect(), "Runtime Asset");
                        editor.OnInspectorGUI();
                    }
                    else
                    {
                        uNodeGUIUtility.ShowFields(script.runtimeAsset, script.runtimeAsset);
                    }
                }
                if (script.target is IClassAsset)
                {
                    if (!Application.isPlaying)
                    {
                        var type = script.target.GeneratedTypeName.ToType(false);
                        if (type != null)
                        {
                            EditorGUILayout.HelpBox("Run using Native C#", MessageType.Info);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("Run using Reflection", MessageType.Info);
                        }
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("The target graph is not supported.", MessageType.Warning);
                }
                if (!Application.isPlaying || script.runtimeAsset == null)
                {
                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button(new GUIContent("Edit Target", ""), EditorStyles.toolbarButton))
                    {
                        uNodeEditor.ChangeTarget(script.target, false);
                    }
                    if (Application.isPlaying && script.runtimeInstance != null)
                    {
                        if (GUILayout.Button(new GUIContent("Debug Target", ""), EditorStyles.toolbarButton))
                        {
                            uNodeEditor.ChangeTarget(script.runtimeInstance, false);
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Please assign the target graph", MessageType.Error);
            }
        }