PUN 1.18 (Preview)

Tobias admin
We've been working on a Photon Unity Networking update for a while and now it's time to see if it also works in the real world.
The new version doesn't affect the API much but behind the scenes it's much more simple, resource-effective and hopefully more stable. It avoids most garbage collection and performance peaks, which is especially nice on mobiles.

Now, we want your feedback :)
Please try it out. Make sure to backup your work and read the change history file. It contains some hints on the update.
It's important to open all scenes of a project, then save them.

Edit: Removed link to preview build. It's now in the Asset Store.


  • how can i change the controller of the demo worker?
    like camera relative controller for mobile.
  • i tried the demo worker on my android phone and it says:

    "Not connected. Check console output.
    Connection failed. Check setup and use Setup Wizard to fix configuration.
  • Oooer, installed and checking it out now :-)

    Thanks for a cool update!
  • cloyd: Did you check the console output?

    Most likely it's the server setup that's wrong. Are you using a Photon Server you host yourself?
    Try using the Photon Cloud, so you don't have to setup a server in your local net, available to your phone.
    The setup is described in the readme, if I reacall correctly.
  • im using photon cloud.
  • On the first try, it seems ok. But after some code's modification (and a compilation of Unity3D), I've got those two errors :
    The Unity recompile forced a restart of UnityPhoton!
    PhotonNetwork:.cctor() (at Assets/Plugins/PhotonNetwork/PhotonNetwork.cs:696)
    PhotonHandler:Awake() (at Assets/Plugins/PhotonNetwork/PhotonHandler.cs:39)
    PhotonHandler:Awake() (at Assets/Plugins/PhotonNetwork/PhotonHandler.cs:37)
    Error: we already have an PhotonMono around!
    PhotonHandler:Awake() (at Assets/Plugins/PhotonNetwork/PhotonHandler.cs:30)
    PhotonNetwork:.cctor() (at Assets/Plugins/PhotonNetwork/PhotonNetwork.cs:704)
    PhotonHandler:Awake() (at Assets/Plugins/PhotonNetwork/PhotonHandler.cs:39)
    PhotonHandler:Awake() (at Assets/Plugins/PhotonNetwork/PhotonHandler.cs:37)

    I found two poor solutions :
    • re-import the PUN's package
    • comment line 31 of PhotonHandler.cs (//Destroy(this.gameObject);)

    I'll continue my testings.
  • 2Kin:
    The first message is OK and needed. We stop the connection on recompile by Unity. The problem is that several variables and objects needed in a live Photon connection are destroyed when Unity recompiles. So if you modify code while running the game, this message will tell you.

    Can you reproduce this: "Error: we already have an PhotonMono around!"? If so, let me know how and I'll take a look.
    It's not a big issue either. Most likely, again, it's related to recompilation while running the game.
  • Tobias wrote:
    Can you reproduce this: "Error: we already have an PhotonMono around!"? If so, let me know how and I'll take a look.
    It's not a big issue either. Most likely, again, it's related to recompilation while running the game.
    Each time Unity recompile my code. I'm on Unity 3.5.7, and this error was not present in PUN 1.17.

    I don't think it's a big issue neither, but it prevents PUN to correctly connect to the "cloud". And after I comment line 31 of PhotonHandler.cs, it connects again (which sounds logic !).
  • Don't modify and save code while running your game connected to Photon.
    We can remove the warning frequency but it's unlikely Photon can stay connected when Unity recompiles.
  • Thats a nasty one.
    I used to get that already back in 1.07 due to incorrectly cleaned up PhotonMono object which due to its hide status is not shown in the hierarchy.

    Unity when crashing upon execution in play mode or ending in an exception tends to not clean this kind of stuff.
    This is also the reason why singleton implementations with non-scene part singletons in general in Unity are a pain at times.

    Never had it due to recompilation though, thats unless someone decided that it a good idea to change scripts while in play mode.
    NEVER DO THAT (can I get an ultra caps). While its claimed to be working its definitely not and Unity will restart the assembly which can mess up more than 'just a bit' ... Thats a word of warning after cleaning a scene from invis temp meshes for 25mins just recently again cause a different team member oversaw the fact doing this is a bad idea.
  • I just updated the package to "1.18p3". Unless you find some issues, this seems to be stable and gets released (uploaded to the Asset Store) next week.
  • What is the release date for the new PUN?
  • It's in the Asset Store by now :)
    Details listed here, too: http://forum.unity3d.com/threads/101734 ... Networking

    We found a minor issue already, but that's not going to be a big change or anything.
This discussion has been closed.