因此,我试图使一个vr游戏在统一和我以下的教程,为如何使一个多人游戏,并导入光子双关语2,并复制了这个代码,但当我试图建立或启动ggame我得到那里errors
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class networkmanager : MonoBehaviourPunCallBacks
{
// Start is called before the first frame update
void Start()
{
ConnectToServer();
}
void ConnectToServer()
{
PhotonNetwork.ConnectUsingSettings();
Debug.Log("Conecting To Server...");
}
public override void OnConnectedToMaster()
{
Debug.Log("Connected To Server!");
base.OnConnectedToMaster();
RoomOptions roomOptions = new RoomOptions();
roomOptions.MaxPlayers = 10;
roomOptions.IsVisible = true;
roomOptions.IsOpen = true;
PhotonNetwork.JoinOrCreateRoom("Lobby 1", roomOptions, TypedLobby.Default);
}
public override void OnJoinedRoom()
{
Debug.Log("Lobby Joined!");
base.OnJoinedRoom();
}
public override void OnPlayerEnteredRoom(Player newPlayer)
{
Debug.Log("A New Player Has Joined The Lobby!");
base.OnPlayerEnteredRoom(newPlayer);
}
}
2条答案
按热度按时间ffx8fchx1#
很简单:将MonoBehaviourPunCallbacks替换为MonoBehaviourPunCallbacks,这些错误应该会消失。
rhfm7lfc2#
您在MonoBehaviourPunCallbacks中将B大写。它必须是小写