How to deal with "Unit" type in Imgui?

How do I use this data type? I still don’t understand what I need to do to read the click

2022.5-0297 preview


Unit is like void, it is no value, only the event. you can use a ForEach reactive, HoldLatest etc. to receive it, or ToObservable to send it…

1 Like

I still don’t understand what I need to do to read the click

something like this? there is no way to utilze the existing pin?


@tonfilm actually in case of button it’s barely usable


maybe there is a reason to add “OnSend” / “OnRecieve” in channel pins?

We were just discussing something similar in the element chat.

Use it like this I think.
The existence of the reactive message IS the bang. Unit is just a stand in type with no data.

Don’t use it like this as you might get issues with subscription occuring in the wrong order, which in turn can give you a ‘phantom’ message on start.


I insist that it must be a node like “Changed” or for consistency “OnData”
First, you can not keep in mind all the time that to catch “change” you need the “holdlatest” node, and secondly, it is terribly scary for new or inexperienced users.

Are there still problems with this type of connection? Will it be fixed later?
I have experienced unpredictable behaviour with this type of connection, but without it a patch feels extremely messy


upd: forgot to create channel, in this case work properly

AFAIK that’s a big. If the channel is being set high by imgui it should be high where it’s read by Value operation.

hey there!
In this example, EN pad never gets written to.
In your updated post you create the Channel, and write to the pad on create, which is one way to initialize it. The other one is just to use the Channel process node.

If you don’t do it, a disabled default channel gets used, a channel that only exists in order to not run into those pink nodes. The fact that you don’t get a pink node should however not lead you into thinking that you don’t need to initialize the property. Related: Does implied creation of a class also create state for internal processes?

Edit: actually in this specific example you don’t need a pad. Just connect a Channel node to all those Checkbox and Value nodes.

@gregsn big thanks for the explanation!
At some point I realised myself what I had done incorrectly. I specifically made this example to illustrate, but the original was much more complex. It turns out that you have to make sure the channels are initialised, maybe it’s not such a bad idea to mark them in colour, it’s hard to imagine using channels without initialisation.