GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ZeroUltra/UnityVisualGraphNode: Unity 可视化节点编辑器

BranchesTags
Open more actions menu

Latest commit

 

History

39 Commits
39 Commits

Folders and files

NameName
Last commit message
Last commit date
Samples~
Samples~
 
 
VisualGraphNodeSystem
VisualGraphNodeSystem
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
LICENSE.meta
LICENSE.meta
 
 
README.md
README.md
 
 
README.md.meta
README.md.meta
 
 
VisualGraphNodeSystem.meta
VisualGraphNodeSystem.meta
 
 
package.json
package.json
 
 
package.json.meta
package.json.meta
 
 

Repository files navigation

UnityVisualGraphNode可视化节点编辑器

介绍

1

image-20241016143032728

  • 高度自由定制
  • 运行时定位节点

使用步骤

  1. 首先新建一个NodeGraphSetting,添加常用配置

    image-20250528151059585

  2. 新建脚本继承NodeBase即可(可直接使用 Project试图中鼠标右键点击->Create->Visual Node C# Script)

    using VisualGraphNodeSystem;
    using VisualGraphRuntime;
    
    //不添加NodeName特性则为脚本默认名
    //节点名字 order:排序(超过10中间会有横线) icon:图标名字(unity中内置图标名字)  visableDesc:是否显示节点描述 titleColorString:标题背景颜色
    [NodeDisplay("node示例", order=1, icon="d_ContentSizeFitter Icon",visableDesc=true, titleColorString="#ffffff"]
    //输入输出端口类型 (输入输出端口数量)
    [NodePortAggregate(NodePortAggregateAttribute.PortAggregate.Single, NodePortAggregateAttribute.PortAggregate.Single)]
    public class NodeSample : VisualNodeBase
    {
        public float waitDuration;
    }
    
                 
                 

    支持自定义序列化保存

    using VisualGraphRuntime;
    using UnityEngine;
    using VisualGraphNodeSystem;
    [NodeName("NodeWait")]
    [NodePortAggregate(NodePortAggregateAttribute.PortAggregate.Single, NodePortAggregateAttribute.PortAggregate.Single)]
    public class NodeWait : VisualNodeBase
    {
        public float waitDuration = 1.0f;
    
        public override string ToSerialize()
        {
            return $"@NodeWait|{waitDuration}";
        }
        public override void FromSerialize(string str)
        {
            waitDuration = float.Parse(str.Split("|")[1]);
        }
    }

​ 其中图标名字均是unity内部icon可参考:jasursadikov/unity-editor-icons) (github.com)

  1. 新建一个NodeGrpah,进行节点编辑

image-20241016134552468

  1. 必须先添加一个Start节点, 其他根据节点内部逻辑,自行编辑代码

  2. 具体可导入Sample文件夹查看示例

注意点

可以对node自行绘制,有两种方式

  • 使用IMGUI,和普通继承Editor重写相同,缺点是如果太多会导致界面卡顿(原因是需要太多draw)
  • 使用UIElements,需要继承VisualGraphNodeView,使用UIElements的UI绘制,这个不会导致卡顿
  • 可使用类似Odin插件等自行绘制

具体代码可查看示例文件夹NodeSampleEditor.cs

测试使用的是Unity2021.3.x 2022.3.x版本

如果有其他版本问题,请提交issue

ChangeLog

v2.0.0

  • 修复节点丢失打不开的情况
  • 现在打开graph是空的,自行添加Start节点作为起始点
  • 更改使用步骤

v1.0.3

  • 修复一些bug
  • 添加窗口Reload按钮,用于重新绘制界面
  • 添加搜索框,搜索节点描述,并定位

v1.0.2

  • [NodeName] 属性增加 titleBgColorString选项,可自定义标题背景颜色
  • 在设置面板中增加默认标题背景色以及是否显示索引选项

v1.0.1

  • 修复界面reload domain之后定位和缩放问题(原先reload之后会变成刚打开的状态)
  • 添加Serialize And Save功能,用于将节点自定义序列化保存/反序列化读取

v1.0.0

提交1.0包

其他

Unity-Visual-Graph-Editor

基于上面这个repo进行了修改

使用的第三方插件:

dbrizov/NaughtyAttributes: Attribute Extensions for Unity (github.com)

About

Unity 可视化节点编辑器

Topics

unityunity-editor

Resources

Readme
Activity

Stars

28 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.