Unity 光子引擎命名空间错误
Unity photon engine namespace errors
我目前正在编写一款与多人游戏统一的游戏。我用教程设置它,但只出现错误。
这是视频:
Video
这是
Errors
这是我的代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Pun;
using UnityEngine.Realtime;
using UnityEngine.UI;
public class Manager : MonoBehaviourPunCallBacks
{
public InputField playername;
public Button playbutton;
void Start()
{
playbutton.interactable = true;
PhotonNetwork.ConnectUsingSettings();
PhotonNetwork.AutomaticallySyncScene = true;
}
void Update()
{
string playerNameText = playername.text;
PhotonNetwork.JoinRandomRoom();
}
public override void OnJoinRandomFailed(short returnCode, string message)
{
RoomOptions roomOps = new RoomOptions();
roomOps.IsVisible = true;
roomOps.IsOpen = true;
PhotonNetwork.NickName = playername.text;
string roomName = "Room" + Random.Range(0, 1000);
PhotonNetwork.CreateRoom(roomName, roomOps);
}
public override void OnJoinRoom()
{
PhotonNetwork.LoadLevel(1);
}
}
感谢您的帮助
更改命名空间:
using UnityEngine.Pun;
using UnityEngine.Realtime;
为此:
using Photon.Pun;
using Photon.Realtime;
我目前正在编写一款与多人游戏统一的游戏。我用教程设置它,但只出现错误。
这是视频: Video
这是 Errors
这是我的代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Pun;
using UnityEngine.Realtime;
using UnityEngine.UI;
public class Manager : MonoBehaviourPunCallBacks
{
public InputField playername;
public Button playbutton;
void Start()
{
playbutton.interactable = true;
PhotonNetwork.ConnectUsingSettings();
PhotonNetwork.AutomaticallySyncScene = true;
}
void Update()
{
string playerNameText = playername.text;
PhotonNetwork.JoinRandomRoom();
}
public override void OnJoinRandomFailed(short returnCode, string message)
{
RoomOptions roomOps = new RoomOptions();
roomOps.IsVisible = true;
roomOps.IsOpen = true;
PhotonNetwork.NickName = playername.text;
string roomName = "Room" + Random.Range(0, 1000);
PhotonNetwork.CreateRoom(roomName, roomOps);
}
public override void OnJoinRoom()
{
PhotonNetwork.LoadLevel(1);
}
}
感谢您的帮助
更改命名空间:
using UnityEngine.Pun;
using UnityEngine.Realtime;
为此:
using Photon.Pun;
using Photon.Realtime;