Sorry for the late reply. Port.isConnected currently only works in editor. This is done so for performance reasons since Port.isConnected is set correctly within a part of the code that is a bit performance heavy and not really needed in runtime.
With that said, I will make isConnected work correctly in runtime as well for consistency in the next version.
Using GetFirstInputConnection() != null is definetely a solution to that which I might just use as well 🙂
Thank you for your input and confirmation that this is needed. I have added this to the roadmap. It’s a bit harder to implement than I thought perfomance wise, cinsidering the current implementation, but it will happen Thank you.
I would not like to ask a question with a too complex answer but I would like to know the reasons why it could lead to a deterioration in performance.
I ask this question because I’m modifying your framework quite intensively for my use case and I wouldn’t want it to make any mistakes that I shouldn’t be making
It’s just that the way isConnected is determined in the editor, is after calling the FlowNode.GatherPorts -> ValidateConnections.
ValidateConnections is currently wrapped in a #if UNITY_EDITOR, because the way validations are made a performance costly (lots of foreach iterations and type conversion checks), which are otherwise not really required in runtime. Unfortunately or not, isConnected is set from within this Validation method.
So, if we were to simply remove #if UNITY_EDITOR and run ValidateConnections method, while isConnected will work correctly, there will be a performance cost.
Thus, the solution would be to find another way to determine isConnected and move it outside of the Validate methods, which requires some refactoring to make sure everything works as intended.