[Help needed] Override ChoosePlayerStart

Hello everyone who entered this thread!

I do have a little problem, with overriding the ChoosePlayerStart function inside the GameMode. Now when this “choose” happens, there are no player controller IDs, only names. So what I do, as you can see in the image below, is check for the first connect (GamePlayPC - listen server) and then place him in the level on a given PlayerStart which has the “server” nametag. The game is a 2 player game, so when the next player joins it checks against any name that’s not just GamePlayPC, and then places him at a PlayerStart which has the “client” nametag.

Now there’s a bit of a problem with this. We have builded the game prototype, and we have two phones, let’s call them X and Y. When we host on X, and join on Y everything works perfectly, the players are placed in a correct spot. However, when we host on Y and join on X, both players get dropped at the same spot, thus ruining the whole game. Anyone has an idea what the problem could be and how to fix it?

**UPDATE: **

After building everything and repackaging the game, neither of the phones are spawning on the “server” side now. So there must be a problem with the name references.

UPDATE #2:

The PIE gives GamePlayPC to the server as name and GamePlayPC1 to Client as name. After Building and packaging server gets GamePlayPC_C_0 and client gets GamePlayPC_C_1 as name. So it looks like it will work now.

Question still stands. Is there any better way to distinguish the controllers rather than using string cutting and appending to go through all the connected players?