Functions are executed same time

If in blueprint in a sequence a function A is called and from next sequence pin another function B is called, second function B should only start executing after function A has finished. Correct? If not, this is not bug.

If I clear an array in function A in a quite slow way with doing a for each loop and manually destroying actors inside and remove them from array, and in function B I add new actors to array, then, depending on speed of execution of function A and B, some of actors I add in B are still destroyed and cleared by function A.

This would be intended behavior for a event, but not for a function as far as I know.

It’s easy to workaround this, just append array in function A to a new local array and clear array directly after this and do for each loop on local array.

Sure, this is function A:

http://puu.sh/gY6EA/0b175d3a4e.png

And this is function B:

http://puu.sh/gY6rQ/d844bb4419.png

And this function is executing both:

http://puu.sh/gY6Lf/6476dc02b3.png

Draw Points is just called every tick.

“Add Points” just does a For each loop on Input Array:

http://puu.sh/gY6Y7/682cfc47bc.png

Actually “workaround” with copying array first into a new local array does not help.

Hi,

Function B should only fire once Function A is resolved, however I have seen instances in earlier versions of engine in which it did not. I haven’t been able to reproduce in 4.7.3 or our main internal build, though. Can you post an image of what you’re doing in Function A so we can try to reproduce it? Thanks!

output I get is this:

LogBlueprintUserMessages: Remove Child at index 1
LogBlueprintUserMessages: Remove Child at index 1
LogBlueprintUserMessages: Remove Child at index 1
LogBlueprintUserMessages: Remove Child at index 1
LogBlueprintUserMessages: Added Child at Index 1
LogBlueprintUserMessages: Added Child at Index 2
LogBlueprintUserMessages: Added Child at Index 3
LogBlueprintUserMessages: Added Child at Index 4
LogBlueprintUserMessages: Array Lenth: 4  --  Children Count: 5
LogBlueprintUserMessages: -----
LogBlueprintUserMessages: Remove Child at index 1
LogBlueprintUserMessages: Remove Child at index 1
LogBlueprintUserMessages: Remove Child at index 1
LogBlueprintUserMessages: Remove Child at index 1
LogBlueprintUserMessages: Added Child at Index 1
LogBlueprintUserMessages: Added Child at Index 2
LogBlueprintUserMessages: Added Child at Index 3
LogBlueprintUserMessages: Added Child at Index 4
LogBlueprintUserMessages: Array Lenth: 4  --  Children Count: 5

And so on.

But child widget is not drawn on parent widget. If I have enough Child widgets (more than 7) then I can actually see some of them (4) and more child widgets I have, more I can see.

If I disconnect “Reset Points” function in “Draw Points” then I see all points correctly, but of course they are all drawn on top of each other with new ones added every frame…

If I remove “Reset Points” function call from “Draw Points” and instead set a timer for it in Event Construct so it’s executed every .5 seconds, I can also see all points, they just flicker every .5 seconds.

I still can’t reproduce this (in 4.7.4, released today). I have a few ideas what might be happening:

First, your method for removing Points is overly complex. Something like this would do same thing:

Still, doing it your way didn’t cause a delay in when first function fired, so that in itself doesn’t appear to be problem.

Second, it looks like your Add nodes are old. Is this an older project converted up to 4.7? If so, you might want to replace old array nodes (Add, Clear, etc) with new versions. I can’t confirm it’s what makes difference, but yours are passing by reference, and new ones don’t do that anymore.

Third, it might help if you add a check in your sub function, AddPoint, to see if Points is empty. If it is, it doesn’t need to create a widget at all.

I tried reproducing your setup bit by bit, exactly way you have in your images, both in an Actor Blueprint and inside a Widget Blueprint, with over 100 Actors. It worked fine for me. If you can look into things I suggested and let me know if any fix issue, please let me know so we can find cause. Also, if you don’t mind, clearest way to tell that function B is starting before Function A finishes is to place a Print String at end of A and at beginning of B. Can you add those and confirm for me that log shows B and then A? Thanks!

Thanks for looking into this! I am myself using 4.7.4 from today.

I only did it way I do it in function A because I hoped it would fix problem, at first I had it that simple as you described. I now changed it back to simple way, it does not change anything.

I also intentionally used “old” pass by reference add nodes because I hoped it would fix problem, but it didn’t, now I changed all back to “new” non-pass by reference nodes. Does not change anything.

I dont’t really need to check whether Points is empty since in my game there are always at least 1 Point inside. If Points is empty, For each Loop in Add Points will just not execute loop.

I really wonder you are not able to reproduce this… So you recreated exact way I am doing this, so you add widgets to a UMG Canvas Panel, and remove all of them in next frame and so on, and you can see all widgets you add?

As you see in log function A does not seem to be executed after function B. Function A is logging “Remove Child …” while function B prints “Added Child …”. So in theory it should work, but it does not.

Could this be an issue with way widgets are added to a UMG Canvas Panel? Something like they are not drawn in same frame as they are added? fact is, if I don’t execute “Reset Points” every frame it does work, so there has to be a bug somewhere in how widgets are added or removed.

Again, thanks a lot for trying to find cause for this bug…

Hey, sorry for delay in response, been a crazy day for me.

I only tested for a possible order of function firing bug, and didn’t really focus on UMG part of it (aside from using a base widget for function tests). I believe this may be an entirely different issue, and I’ll need to examine it as a possible UMG bug. Can you post some screenshots of your widget graph setup? You may be right about order of operations in widgets, I’ll look into that. If you’re able to set up a smaller test project that does same thing, I’d be happy to look at that as well. Thanks!

Screenshots from what widgets graphs? I have posted screenshot from all important parts.

I have tried setting up same stuff in a new test project and I can’t reproduce this. I don’t get it. I did it exact same way, but it does work. Why does it work in a new project?

I believe I found cause for this… If I set ZOrder of created widgets to 1, I can see them even with removing them next frame.

So it seems to be something like, if a new widget is created it has a ZOrder of 0 which gets automatically set to some higher value next frame. If I don’t set it manually to 1 in first frame it get’s drawn below background image.
I guess this is a bug, but it’s clearly not related to functions executing at same time :slight_smile:

Sorry, I said graphs by mistake but I meant design screen. I mostly want to see how you have your CanvasPanelSlot and MovePanel set up, but I should be able to test with a simple widget-in-widget setup regardless.

I’ll check in with our widget guy to see if they’re aware of any zorder issues. You mentioned this doesn’t happen in a new project, so does that mean zorder issue only occurs in your current project, or that you set it up differently in new project?

In new project I had set up ZOrder differently because I thought they would not be important…

Hello

I was able to reproduce this issue on our end. I have written up a report (UE-13486) and I have submitted it to developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Make it a great day