Unexpected Raise reception on PUN 2
Options
Hello
I changed from PUN Classic to PUN2.
Then, every time an object on another terminal with PhotonView & PhotonTransformView moves, a Raise reception event is generated.
EventData.Code that occurs is "201" "206".
Display of console when OnChangePosition () is executed on another terminal.→
Riase Receive:2
default:201
Riase Receive:2
default:201
Riase Receive:2
default:206
Is this Raise reception a specification or is my setting incorrect?
Thank you for reading!
Unity 2019.1.12f1
PUN2 version 2.13
I changed from PUN Classic to PUN2.
Then, every time an object on another terminal with PhotonView & PhotonTransformView moves, a Raise reception event is generated.
EventData.Code that occurs is "201" "206".
Display of console when OnChangePosition () is executed on another terminal.→
Riase Receive:2
default:201
Riase Receive:2
default:201
Riase Receive:2
default:206
Is this Raise reception a specification or is my setting incorrect?
Thank you for reading!
using UnityEngine; using Photon.Pun; using Photon.Realtime; public class PUN2_Test : MonoBehaviourPunCallbacks { //MyObject private GameObject myObje = null; void Start() { PhotonNetwork.ConnectUsingSettings(); } public override void OnConnectedToMaster() { PhotonNetwork.JoinOrCreateRoom("room", new RoomOptions(), TypedLobby.Default); } public override void OnJoinedRoom() { myObje= PhotonNetwork.Instantiate("GamePlayer", new Vector3(0,0,0), Quaternion.identity); } //Button Event public void OnChangePosition() { var v = new Vector3(Random.Range(-10f, 10f), Random.Range(-3f, 3f)); myObje.transform.position = v; }
public class MyRaise : MonoBehaviour { private enum EEvent : byte { event1 = 1 } private void OnEnable() { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; } private void OnDisable() { PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; } //Send.Button Event public void StartRaise() { RaiseEventOptions raiseEventOptions = new RaiseEventOptions { Receivers = ReceiverGroup.All }; SendOptions sendOptions = new SendOptions { Reliability = true }; PhotonNetwork.RaiseEvent((byte)EEvent.event1, "hogehoge", raiseEventOptions, sendOptions); } //Receive public void OnEvent(EventData photonEvent) { Debug.Log("Raise Receive:"+ photonEvent.Sender.ToString()); switch ((EEvent)photonEvent.Code) { case EEvent.event1: Debug.Log("event1 Receive:"+(string)photonEvent.CustomData); break; default: Debug.Log("default:" + photonEvent.Code); break; } } }
Unity 2019.1.12f1
PUN2 version 2.13
0
Best Answer
-
Hi @hirakata,
Thank you for choosing Photon!
LoadBalancingClient.EventReceived event is called for all incoming events not only custom ones.
201 and 206 are PUN specific events. SeePunEvent
class for all codes used for PUN andEventCode
for all codes used for Photon Realtime.
You can ignore those and handle only your own custom events.5
Answers
-
Hi @hirakata,
Thank you for choosing Photon!
LoadBalancingClient.EventReceived event is called for all incoming events not only custom ones.
201 and 206 are PUN specific events. SeePunEvent
class for all codes used for PUN andEventCode
for all codes used for Photon Realtime.
You can ignore those and handle only your own custom events.5 -
Thank you!
solved!0