BeginPlay execution order different in PIE and standalone

Hi,

In PIE, the level blueprint’s BeginPlay execute before my Actor’s but not it’s the other way around. My level blueprint is supposed to set a few properties on BeginPlay that other Actors read during their own BeginPlay calls, meaning my initialization only works in PIE and fails in deploy builds.

Is this intentional or is it a bug? Is there any workaround other than creating custom initialization events on all of my classes and firing them from the level blueprint instead of the unreliable BeginPlay?

Hello,

Thank you for your report. We were not able to investigate this on the engine version you reported, but there have been many version changes to UE4 since this question was first posted. With a new version of the Engine comes new fixes and it is possible that this issue has changed or may no longer occur. Due to timetable of when this issue was first posted, we are marking this post as resolved for tracking purposes. If you are still experiencing the issue you reported in the current engine version, then please respond to this message with additional information and we will investigate as soon as possible. If you are experiencing a similar error, that is not 100% related, could you please submit a new report for it.

Thanks!

Hi,

The problem is still actual (4.10.1/2):

  • Editor: BeginPlay: Controller, Pawn, Mode, State, Actors[] …
  • Build (win64): BeginPlay: Actors[], State, Mode, Pawn, Controller …

For reproducing just add custom Controller, Pawn, Mode and State with print on Begin play. Then play start in editor and launch packaged version. Order of printed messages will be reversed.

Zulman,

Never rely on the nodes to initialize in a specific order, unless you’ve added a check in the blueprint or code for the initialization process to follow.

Thanks!

Hi ,

Thank you for advice. Would you be so kind to share best-practice way for initialization app components in UE4? E.g. we have Controller, Model and View. So, since we unable to rely on basic components as Controller/Pawn/State - what is the best way to init them? Another words - what is the constant entry point of the UE4 project everywhere (built version & editor)? Thanks.

Applications/code do not initialize at the same time on every system. They initialize when they’re finished loading. With that being said, it would be best if you entered checks in with your code/blueprint setup (for example, first check for if this process exists before continuing on with your code.)

I looked through and I did notice UE-21136 entered. It’s still on our to do list and it involved BeginPlay execution order being different on the level start up than dynanic spawning.

Thanks!

2020 v4.25.4 still an issue… and from what I can see there is no information on best practices on how to initialize and ensure priority.