1 Star 0 Fork 0

烟雨迷离半世殇 / xNode_GitSync

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Discord GitHub issues GitHub license GitHub Wiki openupm

Downloads / Asset Store / Documentation

Support xNode on Ko-fi or Patreon

xNode

Thinking of developing a node-based plugin? Then this is for you. You can download it as an archive and unpack to a new unity project, or connect it as git submodule.

xNode is super userfriendly, intuitive and will help you reap the benefits of node graphs in no time. With a minimal footprint, it is ideal as a base for custom state machines, dialogue systems, decision makers etc.

Key features

  • Lightweight in runtime
  • Very little boilerplate code
  • Strong separation of editor and runtime code
  • No runtime reflection (unless you need to edit/build node graphs at runtime. In this case, all reflection is cached.)
  • Does not rely on any 3rd party plugins
  • Custom node inspector code is very similar to regular custom inspector code
  • Supported from Unity 5.3 and up

Wiki

Installing with Unity Package Manager

Via Git URL (Requires Unity version 2018.3.0b7 or above)

To install this project as a Git dependency using the Unity Package Manager, add the following line to your project's manifest.json:

"com.github.siccity.xnode": "https://github.com/siccity/xNode.git"

You will need to have Git installed and available in your system's PATH.

If you are using Assembly Definitions in your project, you will need to add XNode and/or XNodeEditor as Assembly Definition References.

Via OpenUPM

The package is available on the openupm registry. It's recommended to install it via openupm-cli.

openupm add com.github.siccity.xnode

Node example:

// public classes deriving from Node are registered as nodes for use within a graph
public class MathNode : Node {
    // Adding [Input] or [Output] is all you need to do to register a field as a valid port on your node 
    [Input] public float a;
    [Input] public float b;
    // The value of an output node field is not used for anything, but could be used for caching output results
    [Output] public float result;
    [Output] public float sum;

    // The value of 'mathType' will be displayed on the node in an editable format, similar to the inspector
    public MathType mathType = MathType.Add;
    public enum MathType { Add, Subtract, Multiply, Divide}
    
    // GetValue should be overridden to return a value for any specified output port
    public override object GetValue(NodePort port) {

        // Get new a and b values from input connections. Fallback to field values if input is not connected
        float a = GetInputValue<float>("a", this.a);
        float b = GetInputValue<float>("b", this.b);

        // After you've gotten your input values, you can perform your calculations and return a value
        if (port.fieldName == "result")
            switch(mathType) {
                case MathType.Add: default: return a + b;
                case MathType.Subtract: return a - b;
                case MathType.Multiply: return a * b;
                case MathType.Divide: return a / b;
            }
        else if (port.fieldName == "sum") return a + b;
        else return 0f;
    }
}

Join the Discord server to leave feedback or get support. Feel free to also leave suggestions/requests in the issues page.

MIT License Copyright (c) 2017 Thor Brigsted Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
C#
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C#
1
https://gitee.com/NKG_admin/xNode_GitSync.git
git@gitee.com:NKG_admin/xNode_GitSync.git
NKG_admin
xNode_GitSync
xNode_GitSync
master

搜索帮助

14c37bed 8189591 565d56ea 8189591