hello guys i am a little bit new to c# and i have make a script but i dont khow what that error mean “Newline in constant” can anyone help? … here is my code:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class MultiplayerManager : MonoBehaviour
{
public static MultiplayerManager instance;
public string PlayerName;
private string MatchName = "";
private string MatchPassword = "";
private int MatchMaxUsers = 24;
public List PlayerList = new List();
void Start()
{
instance = this;
PlayerName = PlayerPrefs.GetString("PlayerName");
}
public void StartServer(string serveraname, string serverpassword, int maxusers)
{
MatchName = servername;
MatchPassword = serverpassword;
MatchMaxUsers = maxusers;
Network.InitializeServer(MatchMaxUsers, 2550, false);
MasterServer.RegisterHost("DeathMatch", MatchName, "");
//Network.InitializeSecurity();
}
void OnServerInitialized()
{
Server_PlayerJoinRequest(PlayerName, Network.player);
}
void OnConnectedToServer()
{
network.RPC("Server_PlayerJoinRequest",RPCMode.Server, PlayerName, Network.player);
}
}
void OnPlayerDisconnected()
{
networkView.RPC("Client_RemovePlayer,RPCMode.All, id);
}
[RPC]
void Server_PlayerJoinRequest(string playername, NetworkPlayer view);
{
networkView.RPC("Client_AddPlayerToList", RPCMode.All, playername, view)
}
[RPC]
void Client_AddPlayerToList(string playername, NetworkPlayer view)
{
MPPlayer tempplayer = new MPPlayer();
tempplayer.PlayerName = playername;
tempplayer.PlayerNetwork = view;
PlayerList.Add(tempplayer);
}
[RPC]
void Client_RemovePlayer(NetworkPlayer view)
{
MPPlayer temppl = null;
foreach(MPPlayer pl in PlayerList)
{
if(pl.PlayerNetwork == view)
{
temppl = pl;
}
}
if(temppl != null)
{
PlayerList.Remove(temppl);
}
}
public class MPPlayer
{
public string PlayerName = "";
public NetworkPlayer PlayerNetwork;
}
}