PUN 2

PUN 2
As of now, PUN 2 is in the Asset Store. There are two packages (free and plus) which contain the same content, so everyone can just get and use the Free package. Upgrading PUN 1.xy Plus to PUN 2 can be done with PUN 2 Free. Get the Plus package only, if you use PUN 2 Free already and want to get a 100 CCU subscription for a one time fee.

What's new?! PUN 2 has a new structure and comes in just one "root" folder. We cleaned up the naming of many classes, fields and interfaces and there is a new callback system. We created new demos and are in the process of re-writing the documentation (note the v2 in the link). Currently the API reference is only in the package (see the PDF or CHM files). Updating existing projects will be quite some work. Here are the migration notes we took.

Existing subscriptions (e.g. of a previously purchased PUN Plus) can be used with PUN 2. There is no upgrade fee or such! If you got an existing 100 CCU subscription, you can use that. Existing AppIDs can be used in PUN 2 (and vice versa).

Why a second package then?! PUN 2 wraps up a lot of internal refactoring and includes multiple breaking changes for existing PUN projects. As we don't want to break existing projects, PUN 2 got separate packages.

Should I update? Bigger or almost complete projects should probably stick with PUN "Classic". We will keep that package around and update it but we probably won't add more features. Projects starting recently or soon, should use PUN 2.

Something is broken, right?! We tested PUN 2 in early access and with our demos but of course, there can be bugs. When reporting issues in PUN 2, please make sure to tell us you're using PUN 2 already. Reply here or mail to: developer@photonengine.com. Or post in this forum!

Why no upgrade for PUN 1 Plus?! We were unsure if we could still update the old package when we setup an upgrade path in the Asset Store. What's more important: After using the Upgrade, you would not be able to get PUN 1 Plus anymore, updated or not. So we keep things separate for the time being.

Hope you all enjoy!

Comments

  • Gregorio
    Gregorio
    edited September 2018
    Hey! Really nice update. The code is much clearer and organized. The examples are up to date.
    I managed to switch from PUN Classic to PUN 2 with no struggles.
    I continued developing, but now I'm having a problem, now the following error message always shows up. Even in previous versions of the project that used to work. I even tried to change the AppID. Any ideas how to fix it?

    Exception: startCommand.fragmentsRemaining was 0 but not all fragments were found to be combined!
    ExitGames.Client.Photon.EnetPeer.ExecuteCommand (ExitGames.Client.Photon.NCommand command) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:1839)
    ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:413)
    ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1422)
    Photon.Pun.PhotonHandler.FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:126)
  • I'm having a slight issue, for some reason i can no longer call PhotonView.IsMine after upgrading, did i mess something up?
  • The Self-Hosted Server is not working anymore. The client gets disconnected with the error "DisconnectedByServerReasonUnknown" and the server log says: "Unexpected protocol, expected value is between 1.2 and 1.7"
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @ditzel,

    Thank you for choosing Photon!

    You must be using an old PUN2 version, this was fixed, please update PUN2 and try again.
  • Hey guys i have an issue I've been tackling for a while while using PUN2 that maybe you can help me solve.

    Our project (Unity 2018.2.x) has a consistent issue where if we repeatedly attempt to run a photon networked Scene , Unity will freeze up. No crash message nothing. Only way to close is through the task manager and reset. The first time the scene runs will usually have no problems but beyond that it is lik 90% guaranteed to freeze up on me.

    This next part I am not sure is related to that but unity also freezes up from time to time while recompiling changes to the code. And again no crash message, just have to close unity from the task manager.

    Would y'all know what could be causing this? This process has really jus slowed us down having to reset unity after every test or so.
  • Are you using Voice and or Chat, too? Or just PUN?
    Are you using the latest PUN2?
    It might be a Thread that's locking / freezing the editor on recompile. We didn't figure out what's the exact cause for this but closing the connection on disconnect is helping, typically. PUN 2 should do that, however.
    Search for SocketUdpAsync in the LoadBalancingClient. Change the code so it's applied and used on your platform. Try if that makes a difference.
  • Watch out for PhotonHandler's. They tend to get created in the editor and when you run, you might find that there is one in your scene and one that is created when PhotonNetwork is first accessed, so you often end up with one replacing another and ... I am not honestly sure what happens next, but it can't be good.

    Best,

    David
  • As far as we know, PUN no longer causes Unity to lock up. To get there, we make extra sure that any Thread and Socket gets closed, when Unity recompiles or stops running.
    @lilcolombian: If you still have the issue, let us know which product you use.
  • JohnTube
    JohnTube ✭✭✭✭✭
    PUN2 is now the current version.
    PUN1 is in feature freeze mode.

    As you can read in PUN1 docs pages disclaimer on top:

    PUN Classic (also called PUN1) is the original and first major version of PUN. It is now replaced by PUN2 which is refactored and enhanced. We highly recommend starting new projects with PUN2 and if possible migrating existing ones from PUN1 to PUN2 by following our "Migration Notes". PUN Classic will be maintained for the coming months. We will fix important bugs and support new Unity versions but new features will be added only to PUN2.