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);
}
}