Multiple Player States

Hi,
Right now I’m using event CopyProperties in the Player State to transfer properties from my main scene (lobby) to another scene (game level). Works fine, but I see now that I need to use different Player States for each level (because the player properties are different). The event CopyProperties is using only one Player State.
What would be the best way to transfer different properties to different Player States from the same level?

Hey @T4l_R!

So you can try using GetPlayerState and use the Duplicate node, in which you input a location to save the PlayerState, which you could use to set in different levels once you do so, but that’s really roundabout. What is it exactly you’re trying to set via playerstate? Controller? Skeletal Mesh?

Typically you’ll set things in like that in the game mode, playerState is your Account more or less, like achievements unlocked, high score, stuff like that. Is that what you’re looking for?

1 Like

Yeah, that’s kind of what I’m looking for. Right now it’s stuff like score and which team the player is on.

OK! So here’s some documentation on GameState/GameMode. You should give this a skim, then I would suggest writing down and making a diagram of what different parts of the game should go where, it can get a little tricky! It’s very web-like. You would still use playerState for things like how many points an individual player has scored in a multiplayer game, but the overall score and which team they’re on etc would be game State. :slight_smile:

1 Like

Quoting the Persistent Data Compendium:

Usually these Actor classes are different between two different maps (source and destination maps); therefore, if we want to persist data we need to have both child Actor classes inherit from a shared parent Actor class with the shared data inside it.

Properties that you want to persist should be in one parent PlayerState class that the destination and source PlayerState classes inherit from.

1 Like