Download

Sequential function execution across BPs

This strikes me as being something that should be pretty straightforward - and pretty much the bread and butter of event dispatchers, but after a fair bit of reading, I’m suddenly worried that’s not the case and I’m no longer sure how to approach this… This is something I absolutely need to figure out as I was planning to expand on the below principle later.

I have a static mesh with an attached blueprint called hexbase (it’s an hexagonal tile). On Event Begin Play I run a basic function to park variables for the mesh size and width. Once that’s done, I’m trying to use an event dispatcher to carry those variables to another static mesh actor which will pick has variables stored. I do not want to run the function in this BP until after the hexbase has finished (hence why I thought an even dispatcher would be the go). Once that’s finished I was going to use another event dispatcher to either my gamemode bp or level bp to start arraying the tiles around and setting up the map.

Problem is, I can’t get the first event dispatcher to fire. I attached some print strings to the hexbase variables and they are picking up just fine. Then in the second blueprint, I attached some more print strings to check that those variables actually arrived and nada. The string isn’t printing at all… that I’ve had to use a cast to node for the event dispatcher at all has me thinking this is just a complete waste of time and I’d be better just casting to everything where and when I need to - though that will lead to a mess of variables later on down the track, and still doesn’t answer the question of sequence… how do I get a function to execute in one blueprint only after a different function has finished in another?

I’d really rather not have to tie everything into checking every tick as that would also be ridiculous (and expensive in the end).

Images for what I thought was a pretty logical workflow attached.

hexmap:
1.PNG

leveldatabase (an empty actor):
2.PNG

It’s just occurred to me that I probably need to do something else to actually get that print string sequence to fire now, which probably means that event dispatcher isn’t the tool I’m really after here… if that’s the case, my main question stands: how do I get a function to execute in one blueprint only after a different function has finished in another?

I think the problem here is just simply that your BeginPlay in the HexMap is fired before you bind it to an actual event. You can see it if you add a small delay after the Call GetMapDetails.