Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Simple Node Editor

Discussion in 'Works In Progress - Archive' started by Roycon, Aug 29, 2014.

  1. Roycon

    Roycon

    Joined:
    Jul 10, 2012
    Posts:
    50
    Hi All

    Long time unity forum lurker, first time posting.

    I have been working on a node editor extension for unity for some of my personal projects. It has reached the point where it is "done" for personal use, but I am wondering if I should finish it off and release it on the asset store.
    It allows creating and editing any type of node based graph. I plan on using it for Tech/Skill trees, dialog trees, state machines and I want to take a shot at implementing behaviour trees(not sure if I will complete it :p)

    Current Features:
    Visual Node Editor
    Custom Node and Link Types
    Extended Inspector
    Code First

    Picture:
    Node Editor.PNG


    Do people have a need of this extension
    And if so what features would you need?

    Regards,
    Roycon
     
  2. Cynicat

    Cynicat

    Joined:
    Jun 12, 2013
    Posts:
    290
    i think it would need to be configurable. if i could make a UI roughly on par with the animator or unreal blueprint. i would buy this. however if the controls are clunky then i wouldn't. that mean's i would need some clean UI setup's. hopefully with pins for certain connections.

    it also would need to be pretty easy to use.
    how hard is it for me to attach data to a node.
    how hard is it for me to access the nodes it is connected to.
    how hard is it for me to get access to the data on other nodes.

    but yes if you can make a system i can use for my own stuff that's great. but what you would be competing against is stuff like playmaker. all i have to do with that is code an action that draws a dialog box and accepts options and boom, dialog. if you can offer better support than that i think people will buy. i recommend focus on the UI. UI is key in visual system's. UI's to look at: Node Canvas, Unreal Blueprint, Blender Node Editor, FlowHub. all really nice node based UI's.

    also can i ask how you did that IList thingy with the plus and minus symbols? looks alot like the UnityEvent system. looks cool though keep it up =3
     
  3. Roycon

    Roycon

    Joined:
    Jul 10, 2012
    Posts:
    50
    Hi Cynicat

    Thanks for the reply
    And I think you are right about the UI. Its very much a programmer UI atm :p
    The pin links are interesting, I think they would help identify which link goes where. Currently I have to select each link until the right one is blue
    I was basing my prototype UI on mecanim http://unity3d.com/profiles/unity3d/themes/unity/images/unity/animation/state-machines-big.jpg
    maybe I should have used this picture instead
    http://unity3d.com/profiles/unity3d/themes/unity/images/unity/animation/blend-trees-big.jpg

    Answers:
    I tried to make this very simple, as simple = good in my books :p
    Just create a class that inherits off NodeData and add the [Node] attribute then just code away like any normal class. Any public fields will be picked up by Unitys built in serialization/inspector system plus any unity events that go to ScriptableObject. This also means custom inspectors are supported

    Code (CSharp):
    1. [Node("Simple/Simple Node")] //menu path for add context menu
    2. public class SimpleNodeData : NodeData
    3. {
    4. //Stuff Here
    5. }
    6.  
    This is also the same for node links except you use the [NodeLink] attribute and NodeLinkData as the base class.

    Im still working on this side of it but i was thinking each node has a list of node links from it and each node link has To/From references to the nodes. The node container also contains references to all the nodes and node links.

    So you could code something like
    Code (CSharp):
    1. container.RootNode.Links["name"].ToNode
    To access any container, node or node link from a monobehaviour just add a public field of type NodeContainer (or NodeData or NodeLinkData) and assign it from the inspector.

    I was also thinking of putting a lot of helper methods on the NodeContainer class eg GetNodeLinksTo(NodeData n) GetNodesTo(NodeData n) etc

    As for the reorderablelist
    Unity made it public in 4.5 (YAY)
    http://va.lent.in/unity-make-your-lists-functional-with-reorderablelist/
    and for before 4.5 you can use
    https://bitbucket.org/rotorz/reorderable-list-editor-field-for-unity
     
  4. Cynicat

    Cynicat

    Joined:
    Jun 12, 2013
    Posts:
    290
    Very nice! i like the use of attributes =3. also thanks for the link! looking forward to seeing what this becomes. good luck!