Unity GraphToolkit question

Hello. I’m fiddling with the new graph toolkit version for unity 6.4 beta. I see the potential for implementing a structured data filter, but I’m trying to use it as a flow definition tool. As such, I’d like to have multiple output ports each of which has a value assigned, but it doesn’t seem to be possible. Am I missing something? Or is it possible to have this feature? It would change my life so much on a project I’m working on. I tried asking in this discussion where you can also find an image of example (it’s edited) of what I’m imagining.

Output ports do not have a default field, but you can try to set values to ports of any direction with IPort.TrySetValue (available only in the latest alpha) in code, or just passing a value stored in the node as is, though this is not particularly meaningful.

Output ports are intended for transmitting values, not defining them. It’s more logical to have a same set of input ports - this way will allow you not only to set default values in the graph but also to connect other nodes if you need this values to be dynamic.
Of you can just use the ConstantNode for this.

Sadly that’s not what i need. I’d like the user to define a dynamic number of output ports, each of them bearing some kind of complet “tag”, for lack of better words. In essence, imagine each output port is tagged with an arbitrary, non-ordered number that i can the unse when traversing it to populate some assets. But if it’s not possible, I suppose I’ll use Node options to dynamically adjust output ports, even though it’s annoying.

I get that graphs are born to allow to define primarily a data transformation from node to node, but that’s not my case. I just want to define relations between nodes.

Hello,
I’m not entirely sure I understand the design you have in mind, but I’ll try to answer.
First of all, regarding the dynamic number of output ports, I don’t understand why a NodeOption isn’t the right approach. How would you like to handle that?
Next, regarding the values on the output ports, that is indeed not allowed at the moment. I don’t know if this helps, but in 6.6 we’ll allow multiple connections from a single port (input or output), as well as a feature we call PortPreview, which was originally designed so users can inject port values when they run their graph at runtime, for example. But ultimately, that’s just one example of how it can be used; users will use it however they see fit.
Finally, since GTK is a framework, users should be able to configure their graphs as they wish. It is therefore possible that we will allow values on output ports just as we do on input ports. It’s just not a priority at the moment.

@jeanedouard_unity First of all, thank you for the answer!
I’ll try to explain a bit better what I had in mind:

I want to use GTK to define what is essentially a state machine. The runtime structure is already in place and GTK was, in my mind, the perfect tool to create an editor that can be used to edit these state machines. Each node of the graph would represent a state, while connections would represent transitions between states. Since each node can transition to any number of other nodes based on some state or event, I wanted to be able to specify what event triggers what output connection in some way.

Now that I can serialize lists as options, I can serialize the events I want the state to subscribe to and dynamically change the number of outputs based on that. This way i can solve the issue of multiple ports. But I still need to be able to at least show a label near each output port to specify what event that port refers to.

I’m not sure I understand what PortPreview is exactly, is there any documentation/explanation I can read? I realize it’s a bit too s on maybe for that, since 6.4 has just left beta :laughing:
but it could be something I can use for my needs

Ok nevermind, I cannot serialize list options. I can only define list/array ports. I need to be able to dynamically define and tag ports. I see I can give them names, that’s good, but it’s still not enough. Here’s a mock of how I’d like to make one of the nodes I want to define.

Doesn’t have to be exactly like this, obviously. What I’m trying to express is the concept. It doesn’t have to be an “add port button”, it can be some kind of “template port”, or a list option mapped 1:1 to output ports. The output ports field in the image is a string field, but it doesn’t have to be. Specifically for my case, it isn’t, I need it to allow custom drawers.