i am following a tutorial from officialremixgames
his code works just fine but i am getting an error
here’s the 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 = 32;
public List PlayerList = new List();
void Start ()
{
instance = this;
}
public void StartServer(string servername, string serverpassword, int maxusers)
{
MatchName = servername;
MatchPassword = serverpassword;
MatchMaxUsers = maxusers;
Network.InitializeServer(MatchMaxUsers, 2550, false);
Network.InitializeSecurity();
}
void OnServerInitialized()
{
Server_PlayerJoinRequest(“”, Network.player);
}
void OnConnectedToServer(NetworkPlayer id)
{
networkView.RPC(“Server_PlayerJoinRequest”, RPCMode.Server, id, “”, Network.player);
}
void OnPlayerDisconnected()
{
networkView.RPC(“Client_RemovePlayer”, RPCMode.All);
}
[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.PlayNetwork = 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 PlayNetwork;
}
and the error:
Assets/Scripts/MultiplayerManager.cs(68,31): error CS1061: Type MPPlayer' does not contain a definition for
PlayerNetwork’ and no extension method PlayerNetwork' of type
MPPlayer’ could be found (are you missing a using directive or an assembly reference?)
am i missing something?