Some basic questions about PUN

I'm experienced with Unity, but new to networking. And try as I might, I can't wrap my head around a few simple concepts from PUN. Any help clarifying the questions below would be much appreciated!

- - -

1. What are the benefits of deriving from Photon.Monobehaviour? Is this required in some cases?

2. I think I understand how an RPC works (send a message to each specified client that called a message locally on their end), and I get the basic concept for Photon Events, but I'm not sure when to use each. What are their typical usage cases/differences?

3. About Events: In this example from the docs ( near the bottom ), some data is packages and sent as an event to other clients, but I don't understand what catches that data on the client side, or how it's used by the client once received. What am I missing here?

4. Are there "white paper docs" with detailed documentation on the custom classes and methods of PUN (similar to MSDN, the Unity Script Reference, or some other plugins)? And if not, what's the best way to learn the ins and outs of PUN that aren't covered in the few tutorials? Scrubbing through the script file summary comments?

- - -

Serious thanks to anyone who can help, or point my in the right direction. Some of these obstacles are making it hard for me to understand the less novice concepts. Much obliged.


  • This might help and explain a bit: ... o_Tutorial

    1. From the tutorial: "If we make the script a Photon.MonoBehaviour (note the Photon namespace), it can access the GameObject's PhotonView, which in turn provides a "isMine" property." It's just for convenience.

    2. PUN uses Photon features to mimick Unity's built-in networking logic. Photon's events are basically Photon's messages to other players in a room. RPCs are sent as events but specify a "protocol" and "workflow" on top of using events.
    When you need to call a remote method on a specific GameObject and are using PhotonViews, then the RPC is fine. Else, you could build this or similar workflows yourself.

    3. The sender uses an operation (raise event) to make the server send events to other clients. The receiving players just get this event, as defined by the sender. This is passed on to OnEvent(). It's implemented in NetworkingPeer in PUN.
    Within PUN, I don't actually expected that events are used by developers but you could modify this implementation to call some other listener to get the event.

    4. Read the included documentation PDF. It contains some basic topics and the reference doc.