Begin play execution order changed after moving from 4.17 to 4.20
Hi I've just moved my project from 4.17 to 4.20. There is a very peculiar issue I am facing: Begin play execution order in 4.17: PlayerController Class -> Character Class -> GameMode Begin play execution order in 4.20: GameMode -> PlayerController Class -> Character Class Is anyone else having this issue? There is not a single change in my code. I am totally clueless on how and why this might be happening. Thanks!
(comments are locked)
|
Your answer
Follow this question
Once you sign in you will be able to subscribe for any updates here
After a bit of digging, I landed on WorldSettings.cpp where BeginPlay for actors is being called from AWorldSettings::NotifyBeginPlay() Line:222
When It iterator is put in the Watch window, the ObjectArray inside It has pointers to all the actors in the level. The order of this array differs from 4.17 to 4.20.
I understand that the order in which the actor pointers populete this ObjectArray is not deterministic. I have made necessary changes in my code to fix the mistake I made. But out of curiosity I want to know if it's indeed possible to achieve a deterministic execution order for BeginPlay.
Before DispatchBeginPlay is called, is it possible to have one pass to sort this ObjectArray based on some kind of priority which can be set through an int? This can result in a more deterministic behavior for execution order.