UnitySDK vs PUN


Just want to clarify something that was not clear for me since I started to learn how to use Photon:

- Photon can be used thanks to the API delivered with differents SDK (Windows, HTML5, Unity, ...) or PUN
- PUN is an implementation of the UnitySDK by Exitgames, bringing already implemented events and some predefined way to use the network for sync'ing (Photonview etc)

By using PUN the only way to get more controls would be to refactor what was already built: the main problem would be to merge everything every times an update of PUN is released.

In order to get more controls despite the ease of use that come with PUN, we need to implement the plain API.

Am I right ?

If so, could you tell me what are the most important features PUN is bringing ?

Thank you!


  • It's basically: udp < enet < photon-messages { operations, operation-responses, events } < PUN { RPCs, instantiation, viewIDs, destroy, synchronization by stream }

    So: PUN is using normal Photon features, which in turn use enet and that's on top of udp.
    Our goal with PUN was to make it as compatible with Unity Networking as possible so switching is easy. Without it you wouldn't have the RPC calling part, no viewIDs for objects, ownership, etc. Actually, ownership is done in PUN and is client driven. It's not a constant in Photon. PUN clients are just built to know who created an object and then keep that as owner. Switching ownership in this system is complex: Who is allowed to switch? What happens if this person leaves?

    I guess you could access the lower levels though PUN where necessary. The PhotonNetwork.networkingPeer would be the main class of interest. It contains methods that are similar to what the LoadBalancing API offers. RaiseEvent, etc. You could basically keep PUN but use the more customizable RaiseEvent to send your own messages in a room.
    Or if PUN is not offering you a lot of comfort, go with the LoadBalancing API and build on top of that.

    It's very hard to give proper advice here. Either was has drawbacks and requires different types of labor and knowledge.
  • Thank you very much for those informations.

    I think i will take a look at the lower levels and check how PUN enhanced it so I will be able to customize it without rewriting everything.

    Since we didn't use Unity Networking (we are working on our first Multiplayer project and we've chose Photon) the compatibility feature is not our main issue.
  • Let us know if you need something explained. We hope it's straight-forward and the samples in the SDK should show the basics.