Setting variables to NPCs and displaying them in a widget help

and this is where the error takes me to

If you add a Delay of 2s here, does it still generate errors?

oh wow that works!
May I ask why adding a delay here makes it work?

Is it because its trying get GenerateNamesRef because its even spawned and set?

1 Like

Really? I love UE but sometimes I hate it, too. This is nasty. :frowning:


Sorry for the grilling.

1 Like

I really appreciate it!
And no need to apologise, I am here to learn and you have taught me a lot

1 Like

Trying to wrap my head around it. The Delay is just a temporary solution. This needs fixing in a different way.

Okay, so not a final fix but more like a temporary band-aid?

It does seem like it needs a little time for the everything to be set in game mode BP, before this can call on it

1 Like

Precisely.


  • could you add a custom event to the Game Mode where you spawn the generator:

  • when the generator is accessed here:

Try it like this instead:

Right click the reference and convert it to a validated Get, plug the converted node above. And then remove the delay.

1 Like

Sure I can give it a try!
Though I am actually going to Bed now (1am in Japan)
So I will give this a try on my lunch break and post the results here

1 Like

So I followed what you suggested, and it works! This is how it is in my blueprints now, thank you for the help!


1 Like

Btw, last time I had to work around this issue - I used a single Begin Play for the entire game (bar dynamically spawned actors later on).

I first prepped all stuff that was needed upfront and only then broadcasted readiness to all other dependable entities - a fake Begin Play custom event. One foolproof way to do it is to implement an interface on all dependent entities and fire a message once you know critical stuff has been spawned:

image

While using a Delay may seem to work, it is a pretty disappointing solution. What you said - imagine the game needs to wait a wee bit longer to fetch data from the mechanical drive, or the end user (or dev) has a :potato:-grade-:computer:, or whatever other myriad of mysterious processes there could be happening under to hood… and the whole thing stops working.


This is not a new issue, it’s been plaguing the engine since I remember. It just does not manifest that often. What’s more, there are two paths that can mess things up - the BeginPlay order is not really guaranteed and differs for PIE vs Standalone.

1 Like