View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000315||Gameplay + OpenGL||[All Projects] Bug||public||2017-02-21 07:22||2017-02-24 14:47|
|Summary||0000315: Player's BeginPlay called twice when traveling between levels|
|Description||See attached example. BeginPlay is being ran twice on the next level, when you exit the current level normally (not via IDCLEV). Open the console to see the message. Seems to behave the same whether the map is part of a hub or not.|
|Tags||No tags attached.|
aaaaaaaaaa.pk3 (363 bytes)
That's because the map transition spawns a second, temporary player actor.
The thing is, I don't know if it's a good idea to disable the call for this temporary player.
|Would exposing a check to differentiate between the temporary actor and the real, playable actor be a good idea?|
It's easier said than done because the first call during level change (with "dummy" player pawn) is the only one when new game is started.
In other words what call should trigger event callback, first or second?
Maybe there are other considerations but the mentioned one was enough to mark this issue with 'need more knowledge' label for me.
|I had to deal with this in PlayerEntered callback in my event system. You might use that instead for player initialization; it's guaranteed to only call once and on the final player (non-temporary).|
|@ZZYZX: that seems like a viable alternative solution but it also has its share of bugs. Will make a separate ticket for it|
In general I strongly recommend not to rely on PlayerPawn.BeginPlay for anything.
If the issue with the event system is merely the GC I'll have to check that and possibly fix it - if not the event needs to be more reliable. Player spawning is quite messy due to the need to handle voodoo dolls. I can remember that I once added an internal function that gets called after the map is fully loaded to do something with the real player. I think that is where a callback needs to be inserted for custom initialization.
|2017-02-21 07:22||Nash||New Issue|
|2017-02-21 07:22||Nash||File Added: aaaaaaaaaa.pk3|
|2017-02-22 15:20||Graf Zahl||Note Added: 0000704|
|2017-02-24 01:50||Nash||Note Added: 0000731|
|2017-02-24 02:49||_mental_||Note Added: 0000733|
|2017-02-24 04:42||ZZYZX||Note Added: 0000738|
|2017-02-24 05:22||Nash||Note Added: 0000739|
|2017-02-24 10:36||Graf Zahl||Note Added: 0000745|
|2017-02-24 14:47||Graf Zahl||Status||new => resolved|
|2017-02-24 14:47||Graf Zahl||Resolution||open => not fixable|