连接时 Photon 不显示任何日志
Photon does not show me any logs when connecting
我正在做 this tutorial 并且刚刚编写了第一个代码块。以下内容在教程中:
此时,您可以保存启动场景并点击播放。您应该会在 Unity 控制台中看到大量日志。专门查找 "Connected to masterserver." 日志,它表明我们现在确实已连接并准备好加入一个房间。
但是当 运行 这行 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
}
如何启用完整日志记录?
是的,最新版本的 PUN 现在在 Photon 设置本身中提供了日志记录设置。所以把它放在那里。更新后的教程和代码应该很快就会在网站上。
我正在做 this tutorial 并且刚刚编写了第一个代码块。以下内容在教程中:
此时,您可以保存启动场景并点击播放。您应该会在 Unity 控制台中看到大量日志。专门查找 "Connected to masterserver." 日志,它表明我们现在确实已连接并准备好加入一个房间。
但是当 运行 这行 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
}
如何启用完整日志记录?
是的,最新版本的 PUN 现在在 Photon 设置本身中提供了日志记录设置。所以把它放在那里。更新后的教程和代码应该很快就会在网站上。