Can't trigger OnEvent()
Options
Jawah
✭
Hi guys,
First time working with Photon and also with Oculus.
Soo, I'm stuck on an event call.
I really don't know why and I'm using most of the code from this tutorial on the Photon Site:
https://doc.photonengine.com/en-us/pun/current/tutorials/oculusavatarsdk
public void OnJoinedRoom()
{
Debug.Log("OnJoinedRoom");
int viewId = PhotonNetwork.AllocateViewID();
PhotonNetwork.RaiseEvent(InstantiateVrAvatarEventCode, viewId, true, new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache, Receivers = ReceiverGroup.All });
}
private void OnEvent(byte eventcode, object content, int senderid)
{
Debug.Log ("Eureka..");
if (eventcode == InstantiateVrAvatarEventCode)
{
[...]
I'm getting the first Log but It never outputs the second one.
I hope you can help me and feel free to ask if something's unclear
Cheers,
Jawah
First time working with Photon and also with Oculus.
Soo, I'm stuck on an event call.
I really don't know why and I'm using most of the code from this tutorial on the Photon Site:
https://doc.photonengine.com/en-us/pun/current/tutorials/oculusavatarsdk
public void OnJoinedRoom()
{
Debug.Log("OnJoinedRoom");
int viewId = PhotonNetwork.AllocateViewID();
PhotonNetwork.RaiseEvent(InstantiateVrAvatarEventCode, viewId, true, new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache, Receivers = ReceiverGroup.All });
}
private void OnEvent(byte eventcode, object content, int senderid)
{
Debug.Log ("Eureka..");
if (eventcode == InstantiateVrAvatarEventCode)
{
[...]
I'm getting the first Log but It never outputs the second one.
I hope you can help me and feel free to ask if something's unclear
Cheers,
Jawah
0
Comments
-
Hi @Jawah,
I guess OnEvent is actually never called, isn't it? Please make sure, that you register OnEvent as valid event handler. You can do this by addingPhotonNetwork.OnEventCall += OnEvent;
to your code, e.g. to the OnEnable function. Removing the handler can be done with -= in the OnDisable function for example.
This step isn't mentioned in the given guide because it's an essential part of the RPC and RaiseEvent doc page.0
This discussion has been closed.