Download

ChoosePlayerStart seems to be called multiple times

My problem is pretty straight forward since it should be a simple matter but it doesn’t seem to be working as I expected.

I’d like to replace the PlayerStart with another object I created (let’s call it MyStart).

In order to choose between MyStart objects, I’ve overridden the ChoosePlayerStart method in my GameMode.

Based on my special criteria, I return the selected MyStart.

When I run it, what happens is that the ChoosePlayerStart seems to be called multiple times for each player. The fact is that I’m correctly returning MyStart, checking if it was not a null pointer, how could it run again?

Has anyone ever had this problem? I’m stuck with it for a couple of hours now, even tried to understand the engine logic, but it simply didn’t make sense for me.

Thanks.

Can you post the code?

Had this issue, but only when players initially joined the game.
In my case, it was caused by missing information on the player state, which hadn’t had the chance to be updated.
As such, they would incorrectly select one spawn when first joining, then select the correct spawn the second time it was called.
One of the ways I fixed this was to set the PlayerController StartSpot the first time the logged in and check that the next time the function was called.

That’s strange.

Tried as you said, saved the spawn location the first time it selected and in the second time checked if I already had a spawn, then returned the saved reference to it. Somehow It is now crashing on stack overflow on a loop like: ChoosePlayerStart → Check has StartSpot equals to true → return StartSpot → ChoosePlayerStart → …

I wonder if I’m having a different issue of the one you said. Will keep trying.

Thanks, Kris!