im creatin a super power box pvp map and im trying to make it so that once the game starts it gets all the spawners and subscribes to an onplayerspawned event, once it detects a player it chooses his class and gives him his UI. it works well generally but when i start my uefn session it never works in the first round, im wondering if its because the player spawns before all spawners get initialized. how do i fix this?
Are you trying to test from the UEFN launch session? It doesn’t work. I have the same problem and many times I have to test but actually uploading a private map and testing through Fortnite itself. I’m not sure if that’s be design or what but definitely makes testing a lot more difficult.
Add this to your OnBegin, it will ensure any agents who loaded in before devices initialized are handled properly.
And On that note: Make sure to validate your players every time before you do any player handling.
This is an ongoing and poorly/unaddressed issue across the whole platform. Epic will pass you Invalid Players through spawn and server join events and every once in a while you will initialize the player faster than they become active and it can break the game state for the player and in certain cases the game.
By running this validation loop you make sure the player passes that IsActive check before you do anything with them, and while its only the difference of fractions of a second it will save your game state and your code.
I think you got it, it’s just necessary on game join and maybe on respawns but I can’t confirm that. Putting it just on player spawns or server join would be the only necessary action here so it sounds like you are understanding it all correctly and in either case this should clarify
(You should also use it when you submit persistence data updates, but that’s the only other case)