"error CS1003: Syntax Error, ',' expected" (852385)

Hey, I’m very new to unity and coding and I’m trying to follow a tutorial but the code that I use keeps coming up with this error:

Assets\Scripts\MenuController.cs(49,61): error CS1003: Syntax error, ‘,’ expected

Here is the script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MenuController : MonoBehaviour
{
    [SerializeField] private string VersionName = "0.1";
    [SerializeField] private GameObject UsernameMenu;
    [SerializeField] private GameObject ConnectPanel;

    [SerializeField] private InputField UsernameInput;
    [SerializeField] private InputField CreateGameInput;
    [SerializeField] private InputField JoinGameInput;

    [SerializeField] private GameObject StartButton;

    private void Awake()
    {
        PhotonNetwork.ConnectUsingSettings(VersionName);
    }

    private void OnConnectedToMaster()
    {
        PhotonNetwork.JoinLobby(TypedLobby.Default);
        Debug.Log("Connected");
    }

    public void ChangeUserNameInput()
    {
        if (UsernameInput.text.Length >= 3)
        {
            StartButton.SetActive(true);
        }
        else
        {
            StartButton.SetActive(false);
        }
    }

    public void SetUserName()
    {
        UsernameMenu.SetActive(false);
        PhotonNetwork.playerName = UsernameInput.text;
    }

    public void CreateGame()
    {
        PhotonNetwork.CreateRoom(CreateGameInput.text, name new RoomOptions() { maxPlayers = 5 }, null);
    }
   
    public void JoinGame()
    {
        RoomOptions roomOptions = new RoomOptions();
        roomOptions.maxPlayers = 5;
        PhotonNetwork.JoinOrCreateRoom(JoinGameInput.text, roomOptions, TypedLobby.Default);
    }
}

Which tutorial? It looks like you have an error on line 49 which is probably PhotonNetwork.CreateRoom. Please share the code (or the location in the video) where they show this code, it looks like you left out a comma like the error says. A multiplayer game is quite complex for a new developer, you might try some scripting tutorials first.

The problem is on line 50 here (you may have inserted an accidental space at the top when you pasted code):

PhotonNetwork.CreateRoom(CreateGameInput.text, name new RoomOptions() { maxPlayers = 5 }, null);

The second parameter you’re passing to CreateRoom is name new RoomOptions which is syntactically invalid. I’m thinking you just don’t want that “name” text in there.

Ty it worked