How to dynamically set PlayerStart at runtime


I would like to know how to dynamically set PlayerStart using coordinates from file (created and saved to file by SaveData blueprint which I did earlier) or at least any other coordinates.

Did you try “set Actor location” for it?

For singleplayer you do not need to use player start you just spawn player pawn at location
With multiplayer it all gets more complicated i think.

The default game mode behavior for spawning a pawn for a joining player (singleplayer and multiplayer) is to:

  • Iterate over all PlayerStarts and store them in an unblocked list and a blocked list, depending on whether the PlayerStart is free of collision
  • It then selects a random PlayerStart from the unblocked list if there is one, otherwise it randomly selects one from the blocked list

So to answer your question and add to Nawrot’s answer, if you create exactly one PlayerStart then that is the one that is always selected (no matter whether its blocked or unblocked). If at BeginPlay you find the PlayerStart and set its location to your coordinates, that should result in subsequent players being spawned at that location.

(To edit the default spawning behavior you need to extend the GameMode class in C++)

I have tried but without changing game mode. I will try changing game mode as NisshokuZK mentioned.

Just a quick note I’m not suggesting to override the game mode behavior, that is quite drastic unless you’re confident in C++. I would first try to work with the default game mode behavior which I lined out. Could you post some blueprint screenshots of things you tried so far?

Set a player start in the editor as usual then on event begin play move the player to the new location using set actor location on the level blueprint. This should work since the player would change location on the same frame.

Problem solved. I retrieved Save Game Object for start coordinates wrongly and caused errors which blocked location setting. Thanks everyone for help