OnOperationResponse vs OnStatusChanged

BlueSkyzBlueSkyz
edited May 5 in Any Topic & Chat
Hey guys, i'm new to Photon Realtime and i'm trying to get the basics working by piecing together what i can from the tutorials. I'm trying to connect, create and join a room, send/receive events. I think i have connecting to the cloud working by calling connect in my Start method in Unity. However, i'm not sure where to put my OpJoinorCreateRoom should it be in OnStatusChanged - Connect or OnOperationResponse when joinrandom game fails? I have seen tutorials where it is sometimes in one and other times the other. Could someone also just explain how those two methods work? If anyone could post some sample/pseudo code besides the ones on the website of how to: connect, create and join a room, send/receive events, that would be greatly appreciated, thanks for reading!

EDIT: I have gotten those basic things to work in PUN before, are OnStatuschanged or OnOperationResponse and their codes similar to things like OnPhotonJoinFailed OnJoinedRoom etc.?

Comments

  • Hi @BlueSkyz,

    Thank you for choosing Photon!

    If you are familiar with PUN, may I ask why did you switch to Unity SDK?

    You can see PUN as a special Unity SDK with a layer built on top of Realtime SDK. So PUN uses both and it also uses OnEvent. If you take a look at PUN code you will understand better.

    For operation callbacks (e.g. join, create) you should implement the logic inside OnOperationResponse.
    For connection workflow you should implement the logic inside OnStatusChanged.
    For incoming events handling you should implement logic inside OnEvent.
  • Thanks for the response John, i switched because i'm planning on using Playfab for Auth and player data management.
  • Well you can use that with PUN!
  • Wait what, Are you serious? I thought Playfab was only integrated with Photon Realtime since i asked a Playfab dev and he said that i could use it with PUN, but i would have security issues otherwise. Here's the exact quote: "PUN is a great way to enable communication between players, but you need to have your logic somewhere in the critical path of updating the player data to have any kind of cheat prevention. That logic needs to live in a server somewhere - we provide Cloud Script as one tool for that, and we can host custom game servers, which are the most secure way to do it. Photon Realtime is set up to make webhook calls to our Cloud Script whenever rooms are created, joined, closed, etc."
  • JohnTubeJohnTube mod
    edited May 9
    You can use PUN with custom authentication and webhooks which is what PlayFab needs.
    Yes it may be confusing for some people.
    PUN is just a special client SDK for Unity. It uses same Server Code and same Cloud Infrastructure and same API as Realtime. In fact it is just a flavor or variant of Realtime for Unity.
Sign In or Register to comment.