我正在做this tutorial并且刚刚编写了第一个代码块。以下是教程:
此时,您可以保存启动场景并点击“播放”。你应该在Unity Console中看到好几十个日志。专门针对"连接到主人。"记录表明我们现在确实已连接并准备加入房间。
但是我在运行此行PhotonNetwork.ConnectUsingSettings(_gameVersion);
时没有获取任何日志。
public class Launcher : MonoBehaviour
{
#region Public Variables
#endregion
#region Private Variables
/// <summary>
/// Client version number, this number seperates users
/// </summary>
string _gameVersion = "1";
#endregion
#region Monobehavior callbacks
/// <summary>
/// Eary init method of monobehavior
/// </summary>
void Awake()
{
// #NotImportant
// Force Full LogLevel
PhotonNetwork.logLevel = PhotonLogLevel.Full;
PhotonNetwork.networkingPeer.DebugOut = ExitGames.Client.Photon.DebugLevel.ALL; // <---------- added this later but still no logs.
// #Critical
// we don't join the lobby. There is no need to join a lobby to get the list of rooms.
PhotonNetwork.autoJoinLobby = false;
// #Critical
// this makes sure we can use PhotonNetwork.LoadLevel() on the master client and all clients in the same room sync their level automatically
PhotonNetwork.automaticallySyncScene = true;
}
// Use this for initialization
void Start()
{
Connect();
}
/// <summary>
/// Start the connection process.
/// - If already connected, we attempt joining a random room
/// - if not yet connected, Connect this application instance to Photon Cloud Network
/// </summary>
public void Connect()
{
// we check if we are connected or not, we join if we are , else we initiate the connection to the server.
if (PhotonNetwork.connected)
{
// #Critical we need at this point to attempt joining a Random Room. If it fails, we'll get notified in OnPhotonRandomJoinFailed() and we'll create one.
PhotonNetwork.JoinRandomRoom();
}
else
{
// #Critical, we must first and foremost connect to Photon Online Server.
PhotonNetwork.ConnectUsingSettings(_gameVersion);
// <----------------------------- This is reached!
}
}
// Update is called once per frame
void Update()
{
}
#endregion
}
如何启用完整日志记录?