Multiplayer pass int from lobby to game scene

So I’m currently working on my first multiplayer game and I’m stuck. I have a character selection screen in a lobby but I’m not sure how to get the selected character (an int) into the actual game scene. How can I send a value and the player that sent it into the game scene from the lobby?

The simplest way is to just make a static variable.

public static class Globals {
    public static int selectedCharacter;

It’ll stick between levels and is accessible from anywhere without requiring a reference.

void OnClick() {
    Globals.selectedCharacter = 5;

Load level…

void Awake() {

If you need more information, you can add more static variables. If you grow tired of having a bunch of static variables (perhaps you keep adding lots of variables but it gets messy because some of them belong to one another while others dont), create a class to structure your data and make Globals reference an instance of your class.

You can also create a game object that has components that carry data. You can call DontDestroyOnLoad(gameObject) in Awake to keep it even when the level changes.