OnlineSession vs GameSession

@FrostyJas o the unreal framework provides two classes: UOnlineSession and AGameSession. Both with seemingly similar functionality. The differences are:

UOnlineSession

  • Owned by Game Instance
  • Persists for lifetime of application
  • Exists on clients and servers
  • Very much so a shell of a class (only 6 virtual functions with ZERO default implementations)

AGameSession

  • Owned by GameModeBase
  • Only on server
  • Exists for lifetime of the gamemode / world
  • Tons of functionality with default implementations and ties to AGameMode

So I’m torn because on the one hand, I need to implement my session logic in a way that is persistent across Worlds, especially for continuous playlist sessions or map vote switches, leaning me toward OnlineSession. I don’t want to do some hacky solution with the GameSession where I make a temp copy of the important state data in order to transition levels.
On the other hand, GameSession has a ton of existing functionality and is already designed to hook deeply into the GameMode with player registering, match starting, stopping, etc.

Is there a right answer here?

edit: @FrostyJas thanks for responding, this was the origininal post but i didn’t know that i can carry the game session actor across seamless travels, so i think this is the correct option!

Greetings @DELGOODIE

I see that you had some questions on game sessions. Were you able to resolve the issue? If not, toss me some info on what you’re running into and I’ll be happy to take a peek! Thanks!

Oh, I see! Honestly, I think it’s preference and situational. But, I’m glad you found some direction with it!