C# 光子OnRoomProperties更新不工作
我有一个更新自定义属性的简单方法(通过Photonnetwork.CurrentRoom.setCustomProperties(哈希表))。 它会在调用它的本地玩家身上得到更新(OnRoomPropertiesUpdate方法不会被调用),但房间中的其他玩家不会得到更改。 请帮忙C# 光子OnRoomProperties更新不工作,c#,unity3d,photon,C#,Unity3d,Photon,我有一个更新自定义属性的简单方法(通过Photonnetwork.CurrentRoom.setCustomProperties(哈希表))。 它会在调用它的本地玩家身上得到更新(OnRoomPropertiesUpdate方法不会被调用),但房间中的其他玩家不会得到更改。 请帮忙 // method that i call to update custom properties public void sync_state(int value) { ExitGames.Clie
// method that i call to update custom properties
public void sync_state(int value)
{
ExitGames.Client.Photon.Hashtable hash = PhotonNetwork.CurrentRoom.CustomProperties;
Debug.Log("SYnCING ==== Value: "+hash["val"]+
hash["val"] = value;
PhotonNetwork.CurrentRoom.SetCustomProperties(hash);
}
// this method never gets called.
public override void OnRoomPropertiesUpdate(ExitGames.Client.Photon.Hashtable propertiesThatChanged)
{
Debug.Log("Room properties updated ");
/// my other code
UPDATE_GAME_STATE(propertiesThatChanged);
}
嗨,谢谢你选择光子!确保所有客户端都加入到同一个房间。如果您在
回调
中覆盖OnEnable
,请确保调用base.OnEnable。您好,感谢您选择光子!确保所有客户端都加入到同一个房间。如果在回调中重写OnEnable
,请确保调用base.OnEnable
。