(Unity) 显示加入的房间名称?光子双关语
(Unity) Display Joined Room Name? Photon PUN
我用photon unity做了一个多人游戏,当玩家加入房间时我想在场景中显示加入房间的名字
请告诉我该怎么做?
只需使用 OnJoinedRoom
and get the PhotonNetwork.CurrentRoom
and then its Name
,例如
public void OnJoinedRoom ()
{
var roomName = PhotonNetwork.CurrentRoom.Name;
Debug.Log($"Joined room {roomName}");
// ... However you want to display it e.g. assign it to an UI.Text or TextMeshPro etc
}
我用photon unity做了一个多人游戏,当玩家加入房间时我想在场景中显示加入房间的名字 请告诉我该怎么做?
只需使用 OnJoinedRoom
and get the PhotonNetwork.CurrentRoom
and then its Name
,例如
public void OnJoinedRoom ()
{
var roomName = PhotonNetwork.CurrentRoom.Name;
Debug.Log($"Joined room {roomName}");
// ... However you want to display it e.g. assign it to an UI.Text or TextMeshPro etc
}