Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- error:
- Assets/Scripts/Network/Menu.cs(81,25): error CS0246: The type or namespace name `Player' could not be found. Are you missing a using directive or an assembly reference?
- using UnityEngine;
- using System.Collections;
- public class Menu : MonoBehaviour {
- private string CurMenu;
- public string Name;
- public string MatchName;
- public int Players;
- // Use this for initialization
- void Start () {
- CurMenu = "Main";
- Name = PlayerPrefs.GetString("PlayerName");
- }
- // Update is called once per frame
- void Update () {
- }
- void ToMenu(string menu){
- CurMenu = menu;
- }
- void OnGUI(){
- if (CurMenu == "Main")
- Main();
- if (CurMenu == "Host")
- Host();
- if (CurMenu == "Lobby")
- Lobby();
- if (CurMenu == "List")
- MatchList();
- }
- private void Main(){
- Error:(Sending RPC 'Client_PlayerJoined' failed because the number of supplied parameters doesn't match the rpc declaration. Expected 2 but got 3 parameters
- .
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class NetworkManager : MonoBehaviour
- {
- public string PlayerName;
- public string MatchName;
- public static NetworkManager Instance;
- public List<Player>PlayerList = new List<Player>();
- public Player MyPlayer;
- // Use this for initialization
- void Start () {
- Instance = this;
- DontDestroyOnLoad(gameObject);
- }
- // Update is called once per frame
- void Update () {
- PlayerName = PlayerPrefs.GetString("PlayerName");
- }
- public void StartServer(string ServerName, int MaxPlayers)
- {
- Network.InitializeSecurity();
- Network.InitializeServer (MaxPlayers, 25565, true);
- MasterServer.RegisterHost("Tut", ServerName, "");
- Debug.Log("Started Server");
- }
- void OnPlayerConnected(NetworkPlayer id)
- {
- //networkView.RPC ("Server_PlayerJoined", RPCMode.Server, PlayerName, id);
- foreach (Player pl in PlayerList)
- {
- networkView.RPC("Client_PlayerJoined",id,pl.PlayerName, pl.OnlinePlayer);
- }
- }
- void OnServerInitialized()
- {
- Server_PlayerJoined (PlayerName, Network.player);
- }
- void OnConnectedToServer()
- {
- networkView.RPC ("Server_PlayerJoined", RPCMode.All, PlayerName, Network.player);
- }
- [RPC]
- public void Server_PlayerJoined(string Username,NetworkPlayer id)
- {
- networkView.RPC("Client_PlayerJoined", RPCMode.All,PlayerName,Username, id);
- }
- [RPC]
- public void Client_PlayerJoined(string Username,NetworkPlayer id)
- {
- Player temp = new Player();
- temp.PlayerName = Username;
- temp.OnlinePlayer = id;
- PlayerList.Add(temp);
- if (Network.player == id)
- {
- MyPlayer = temp;
- }
- }
- [System.Serializable]
- public class Player{
- public string PlayerName;
- public NetworkPlayer OnlinePlayer;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement