{"id":19482541,"url":"https://github.com/zeroultra/unityvisualgraphnode","last_synced_at":"2025-04-25T15:33:07.580Z","repository":{"id":144595644,"uuid":"422515232","full_name":"ZeroUltra/UnityVisualGraphNode","owner":"ZeroUltra","description":"Unity 可视化节点编辑器","archived":false,"fork":false,"pushed_at":"2025-03-27T13:32:22.000Z","size":11285,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T00:12:46.543Z","etag":null,"topics":["unity","unity-editor"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZeroUltra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-29T09:23:48.000Z","updated_at":"2025-03-27T13:32:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5e371cb-dbdd-4f7e-8c50-b1aff356ef03","html_url":"https://github.com/ZeroUltra/UnityVisualGraphNode","commit_stats":null,"previous_names":["zeroultra/unityvisualgraphnode"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeroUltra%2FUnityVisualGraphNode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeroUltra%2FUnityVisualGraphNode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeroUltra%2FUnityVisualGraphNode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeroUltra%2FUnityVisualGraphNode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZeroUltra","download_url":"https://codeload.github.com/ZeroUltra/UnityVisualGraphNode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250844541,"owners_count":21496595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["unity","unity-editor"],"created_at":"2024-11-10T20:11:06.591Z","updated_at":"2025-04-25T15:33:07.573Z","avatar_url":"https://github.com/ZeroUltra.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UnityVisualGraphNode\n## Unity 可视化节点编辑器\n\n![1](https://raw.githubusercontent.com/ZeroUltra/MediaLibrary/main/Imgs/202211131344795.gif)\n\n![image-20241016143032728](https://raw.githubusercontent.com/ZeroUltra/MediaLibrary/main/Imgs/202410161430531.png)\n\n* 高度自由定制\n* 运行时定位节点\n\n## 如何使用\n\n1. 新建脚本继承`NodeBase`即可(可直接使用 Project试图中鼠标右键点击-\u003eCreate-\u003eVisual Node C# Script)\n\n    ```c#\n    using VisualGraphNodeSystem;\n    using VisualGraphRuntime;\n    \n    //不添加NodeName特性则为脚本默认名\n    //节点名字 order:排序(超过10中间会有横线) iconName:图标名字(unity中内置图标名字)  titleBgColorString:标题背景颜色\n    [NodeName(\"node示例\", order=1, iconName = \"d_ContentSizeFitter Icon\"),titleBgColorString=\"#ffffff\"]\n    //输入输出端口类型 (输入输出端口数量)\n    [NodePortAggregate(NodePortAggregateAttribute.PortAggregate.Single, NodePortAggregateAttribute.PortAggregate.Single)]\n    public class NodeSample : VisualNodeBase\n    {\n        public float waitDuration;\n    }\n    \n    ```\n\n​\t其中图标名字均是unity内部icon可参考:[jasursadikov/unity-editor-icons) (github.com)](https://github.com/jasursadikov/unity-editor-icons)\n\n​\t支持自定义序列化保存\n\n```c#\nusing VisualGraphRuntime;\nusing UnityEngine;\nusing VisualGraphNodeSystem;\n[NodeName(\"NodeWait\")]\n[NodePortAggregate(NodePortAggregateAttribute.PortAggregate.Single, NodePortAggregateAttribute.PortAggregate.Single)]\npublic class NodeWait : VisualNodeBase\n{\n    public float waitDuration = 1.0f;\n\n    public override string ToSerialize()\n    {\n        return $\"@NodeWait|{waitDuration}\";\n    }\n    public override void FromSerialize(string str)\n    {\n        waitDuration = float.Parse(str.Split(\"|\")[1]);\n    }\n}\n```\n\n\n\n2. 新建一个NodeGrpah,进行节点编辑\n\n ![image-20241016134552468](https://raw.githubusercontent.com/ZeroUltra/MediaLibrary/main/Imgs/202410161435752.png)\n\n3. 根据节点内部逻辑,自行编辑代码\n4. **具体可导入Sample文件夹查看示例**\n5. `NodeGraphSetting`是一些常用配置\n\n\n\n## 注意点\n\n**可以对node自行绘制,有两种方式**\n\n* 使用IMGUI,和普通继承Editor重写相同,缺点是如果太多会导致界面卡顿(原因是需要太多draw)\n* 使用UIElements,需要继承VisualGraphNodeView,使用UIElements的UI绘制,这个不会导致卡顿\n* 可使用类似Odin插件等自行绘制\n\n具体代码可查看示例文件夹`NodeSampleEditor.cs`\n\n\n\n测试使用的是**Unity2021.3.x 2022.3.x**版本\n\n如果有其他版本问题,请提交issue\n\n## ChangeLog\n\n#### v1.0.3\n\n* 修复一些bug\n* 添加窗口`Reload`按钮,用于重新绘制界面\n* 添加`搜索框`,搜索节点描述,并定位\n\n#### v1.0.2\n\n* [NodeName] 属性增加 titleBgColorString选项,可自定义标题背景颜色\n* 在设置面板中增加默认标题背景色以及是否显示索引选项\n\n#### v1.0.1\n\n* 修复界面reload domain之后定位和缩放问题(原先reload之后会变成刚打开的状态)\n* 添加`Serialize And Save`功能,用于将节点自定义序列化保存/反序列化读取\n\n#### v1.0.0\n\n提交1.0包\n\n## 其他\n\n[Unity-Visual-Graph-Editor](https://github.com/BusStopStudios/Unity-Visual-Graph-Editor)\n\n基于上面这个repo进行了修改\n\n使用的第三方插件:\n\n[dbrizov/NaughtyAttributes: Attribute Extensions for Unity (github.com)](https://github.com/dbrizov/NaughtyAttributes)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroultra%2Funityvisualgraphnode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeroultra%2Funityvisualgraphnode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroultra%2Funityvisualgraphnode/lists"}