📓

MasterServerAutoSetup

public class MasterServerAutoSetup : MonoBehaviour
{
    public static bool autoMasterServer = false;
    public static int autoMasterServerPort = 7000;
    // Start is called before the first frame update
    void Start()
    {
        Application.targetFrameRate = 60;
        Console.WriteLine("Auto server setup with port "+ autoMasterServerPort);
        autoMasterServer = true;
        SceneManager.LoadScene("Join");
    }

}
//...

This Unity component on start up, sets autoMasterserver to true and changes to the Join Unity Scene. Join Scene from there will take care of automatically setting up the game instance to run as a Master Server without any input.

Note: The way I use this one is that I put it on a Unity GameObject in a different Unity Scene in my project and only build the project with that Scene to run first for my Master Server builds. You could change how this logic comes about, but I prefer to have separate builds for this auto servers so regular users don’t accidentally come across them.

Methods

void Start()

Sets up that it will indeed be an autoMasterServer, then loads the Join scene which you may want to change