unity3d 我的代码有什么问题,我在统一中使用光子双关语2

2vuwiymt  于 2022-12-13  发布在  其他
关注(0)|答案(2)|浏览(137)

因此,我试图使一个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);
    }
}
ffx8fchx

ffx8fchx1#

很简单:将MonoBehaviourPunCallbacks替换为MonoBehaviourPunCallbacks,这些错误应该会消失。

rhfm7lfc

rhfm7lfc2#

您在MonoBehaviourPunCallbacks中将B大写。它必须是小写

相关问题