我正在尝试使用 PUN 2 在 oculus 和 pc 上创建跨平台游戏,但我无法连接到服务器并且卡在加载屏幕上
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using UnityEngine.SceneManagement;
public class ServerLoader : MonoBehaviourPunCallbacks
{
void Start()
{
Debug.Log("attempting to connect");
PhotonNetwork.ConnectUsingSettings();
Debug.Log("Connected once");
}
public override void OnConnectedToMaster()
{
Debug.Log("Connected twice");
if(Application.platform == RuntimePlatform.WindowsPlayer)
{
Debug.Log("attempting join lobby");
PhotonNetwork.JoinLobby();
Debug.Log("Joining lobby");
}
else if(Application.platform == RuntimePlatform.Android)
PhotonNetwork.CreateRoom(RandomStringGenerator(6));
Debug.Log("Joining game");
}
public override void OnJoinedRoom()
{
PhotonNetwork.LoadLevel("Game");
}
public override void OnJoinedLobby()
{
SceneManager.LoadScene("Lobby");
}
string RandomStringGenerator(int length)
{
string characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
string generated_string = "";
for(int i = 0; i < length; i++)
generated_string += characters[Random.Range(0, length)];
return generated_string;
}
}
在输出中打印的唯一日志是“尝试连接”和“连接一次”
我尝试运行游戏并卡在加载屏幕上我希望在我的电脑上运行这个游戏时加载到大厅