Question by
turfur · Jan 07, 2016 at 01:41 PM ·
errorunity5unexpected-symbol
Error CS1525: Unexpected symbol `;', expecting `)', or `,'
using ExitGames.Client.Photon; using UnityEngine; using System.Collections; using Hashtable = ExitGames.Client.Photon.Hashtable;
public class IELdemo : Photon.MonoBehaviour { public Transform[] cubes;
#region CONNECTION HANDLING
public void Awake()
{
if (!PhotonNetwork.connected)
{
PhotonNetwork.autoJoinLobby = false;
PhotonNetwork.ConnectUsingSettings("0.9");
}
}
// This is one of the callback/event methods called by PUN (read more in PhotonNetworkingMessage enumeration)
public void OnConnectedToMaster()
{
PhotonNetwork.JoinRandomRoom();
}
// This is one of the callback/event methods called by PUN (read more in PhotonNetworkingMessage enumeration)
public void OnPhotonRandomJoinFailed()
{
PhotonNetwork.CreateRoom(null, new RoomOptions() {maxPlayers = 4}, null);
}
// This is one of the callback/event methods called by PUN (read more in PhotonNetworkingMessage enumeration)
public void OnJoinedRoom()
{
}
// This is one of the callback/event methods called by PUN (read more in PhotonNetworkingMessage enumeration)
public void OnCreatedRoom()
{
}
#endregion
public void Update()
{
if (PhotonNetwork.isMasterClient)
{
//Only control the cubes if MC
float movement = Input.GetAxis("Horizontal") * Time.deltaTime * 15;
foreach (Transform tran in cubes)
{
tran.position += new Vector3(movement, 0, 0);
}
}
}
public void OnGUI()
{
GUILayout.Space(10);
if (PhotonNetwork.isMasterClient)
{
GUILayout.Label("Ping: " + PhotonNetwork.GetPing();
}
else if (PhotonNetwork.isNonMasterClientInRoom)
{
GUILayout.Label("Ping: " + PhotonNetwork.GetPing();
}
else
{
GUILayout.Label("Not connected..." + PhotonNetwork.connectionStateDetailed);
}
}
}
Error:
Assets/Photon Unity Networking/Demos/DemoSynchronization/IELdemo.cs(63,75): error CS1525: Unexpected symbol ;', expecting
)', or `,'
Comment
Best Answer
Answer by gjf · Jan 06, 2016 at 02:42 PM
please format ALL of your code so the error line matches the message.
that said, it looks like you're missing a )
after .GetPing()
in your GUILayout.Label
calls...