问题描述
我正在使用 Unity Pun2 开发服务器.
I am developing a server using Unity Pun2.
我的问题是当用户参与时没有调用 OnJoinedRoom().
My problem is that the OnJoinedRoom() is not called when the user participates.
有两种情况
创建房间并首次添加时 - 称为
When making a room and adding it for the first time - called
然后,当另一方加入房间时 - 不叫
Then, when another party joins the room - not called
public override void OnJoinedRoom()
{
if (PhotonNetwork.CurrentRoom.PlayerCount == 1)
{
PhotonNetwork.LoadLevel("RoomFor1");
}
}
++我的问题是主客户端称为 OnJoinedRoom,但其他客户端不称为 OnJoinedRoom.
++my problem is that the master client is called OnJoinedRoom, but the other clients are not called OnJoinedRoom.
推荐答案
使用 OnPlayerEnteredRoom() 检查是否另一个玩家进入了你所在的房间
use OnPlayerEnteredRoom() to check if another player entered the room you are in
使用 OnJoinedRoom() 检查自己是否成功加入房间
use OnJoinedRoom() to check if you yourself have successfully joined a room
这篇关于用户加入时不调用 OnJoinedRoom 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!