If you use “Collapse to Function” menu item it creates a new function with a return node that can’t be deleted. This can be a real hassle for complex functions that end up having multiple execution paths. Either it shouldn’t add node at all, or it should allow return nodes from functions with no outputs to be deleted.
Step 1: Create node(s), in this test case I just made a variable and called its setter.
Step 2: Select node(s), right click and pick “Collapse To Function”
Step 3: Optionally rename new function and switch to it’s graph. See new extra return node even though this function has no return values aka Outputs.
Hi ,
I can verify that I’m seeing same behavior, however I’m failing to see a circumstance in which this becomes a problem. You mention that it can be a hassle for complex functions with multiple execution paths. Can you elaborate on that and provide an example? Thanks!
Hi ,
We haven’t heard back from you in a while, so I’m going to mark this post as resolved for tracking purposes. If you have a specific case for which this behavior causes a problem, please feel free to reopen this post. Thanks!
I’m not sure how to reopen a ticket. But here is an example where it breaks code by adding this node.
I selected this for loop in my Event Graph, and used Collapse to Function to refactor it out. You’ll see that when it added new Return Node, that it linked BOTH set speed node and forloop completed node.
This breaks loop because now it’s returning after first instance of loop is done, not when it’s gone through entire loop. If it hadn’t made return node in first place, function would have worked properly.
If you detach Set Speed node, would it continue to work as you expect?
That’s not point I’m trying to make, but yes.
Is problem simply that it automatically connects last node to Return Node?
I can enter a bug report for this, but I want to make sure I’m not missing anything that makes this a more critical bug. Right now, it doesn’t seem to have a lot of impact.
It is mostly just a nuisance bug, but since you can create your own functions without return nodes just fine, it seems to me editor would just be overall better off if “Collapse to Function” feature didn’t make a return node at all. Or if it would let you delete node if function had no outputs. As it is now like with my forloop example, it can introduce undesirable side effects that would baffle inexperienced users.
Okay, sounds good. I have entered a bug report (UE-7638) and included your example of how this could cause a problem. I’ll let you know when I see an update on it. Thanks for report!