I can give high level advice of possible approaches but I don’t think there is a common practise to adhere to that you can follow to a T, each game and use case always have different needs, and every approach will have its pros and cons. It is up to you to decide how you want to handle your data, we just give the tools to do so.
- How would the game assign the teams and character avatars for the players within the lobby?
The only way to store data within a lobby is to use the attribute system. The main use case for attribute usage is for matchmaking purposes. For example, lets say you want a MMR system in your game, and you want to match players based on a skill rating, you can use the lobby attributes to calculate the average MMR of any given Lobby and matchmake a player against different lobbies based on his own rating.
However, is not the only use case, if you have a very simple lobby system that doesn’t require low-latency high speed replication, you can use the Lobby attributes to store whatever data you need from your Lobby, in your case, the team a player belongs to.
I don’t know how you’re referencing “character avatars” or what specifically this refers to inside Unity, but if you can reference it simply with a string, you can also use the Lobby attributes for that.
If your Lobby system requires more involved replication then you can always start a room together with your Lobby and use the room to replicate whatever data you need.
- How is the player data information from the lobby passed to a player connection object within the game session?
coherence doesn’t have any specific tools to do this. Player connection objects are described here: Client Connections | SDK 1.2 | Unity Multiplayer SDK Documentation | coherence
You can create a MonoBehaviour, attach it to your client connection prefab, and have it fetch your current team from the Lobby in the Awake method, you can fetch your current team by referencing the coherenceBridge and accessing your current lobby from there.
This is one possible approach off the top of my head that I can come up with, without looking at your actual project.
- If not passed directly, how can the player connection object determine which lobby player it came from?
This is responsibility of each client. A client connection instance should figure out his own team and replicate it to others.
- How does a GameManager gain access to the data for all of the players in the game session?
It is all available through the CoherenceBridge.
I’m not entirely sure what you mean by the data for all the players, in the Lobby or when you’re already inside of a room?
Lobby players are available through your current Lobby Session that you can get from the Lobby Service instance, accessible via the CoherenceBridge.CloudService instance, you can see examples of this in the Lobby samples.
If you mean when you’re already connected to a room, like I mentioned previously, you can use the Client Connection prefabs to store specific data about a player. But you can also use another entity of your choosing. This is very game specific to give a one-fits-all solution, but we’re happy to help provide advice if you give specific examples of implementations you’re trying to achieve.