Photon Unity Networking Photon Unity Networking (PUN) is being put into Long Term Support mode as of July 2021. We are finishing Fusion, our state of the art, MonoBehaviour-based networking solution. Fusion is recommended for all recent and new projects! PUN support will continue but there are no major changes planned. The Photon Cloud will also continue to support existing games indefinitely. Download: PUN 2 Free from the Asset Store. Overview This package implements a comfortable Unity-specific networking API on top of Photon. Keeping the API simple, this gives you dedicated servers, matchmaking, in-game communication, fixes, tweaks and ongoing support. This package contains a setup wizard, the fully integrated API, Editor extensions and the client library. It's compatible with the Photon Cloud Service, so you don't even have to setup a server! Requirements Unity 2018.4 or up. Server Options Photon Cloud Service: www.photonengine.com/en/Realtime Free for 20 concurrent users. Photon Standalone server: www.photonengine.com/en-US/OnPremise/Download Free 100 concurrent users (CCU) license. Registration required. PUN 2 There are two "PUN 2" packages in the Asset Store: Both contain the same content, so everyone can just get and use the Free package. The Plus package includes a 100 CCU subscription, which is good for a bigger test group or an early soft launch (100 CCU cover approximately 40k monthly active users). 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. Should I update from PUN Classic? Definitely! PUN Classic is outdated. Existing subscriptions (e.g. of a previously purchased PUN Classic Plus) can be used with PUN 2. There is no upgrade fee whatsoever. Reply here or mail to: firstname.lastname@example.org. Release History (recent release) v2.40 (22. November 2021) Fixed: Unity 2021.2 support. PhotonEditorUtils.IsPrefab now uses the correct prefab stage utility for Unity 2021.2 and up. Changed: PhotonHandler.Dispatch is now catching exceptions. It will count them but only provide the first one's callstack (to avoid log spamming). Note: While the Photon lib caught exceptions in v184.108.40.206, that has not been a good solution. This new approach can be changed in source and is more flexible overall. Changed: On Xbox, the peer classes no longer assume a native socket plugin exists. This was setting the UDP implementation to null in some cases, which failed to connect. Updated: Library and Realtime to 220.127.116.11. More details in the change logs. v2.39 (21. October 2021) Changed: PhotonTransformView interpolation of position and rotation. It's now framerate independent. Updated: Library to 18.104.22.168. More details in changes-library.txt. v2.38 (12. October 2021) Updated: Library to 22.214.171.124. More details in changes-library.txt. v2.37 (27. September 2021) Added: CustomType deserialization length checks. Added: PhotonNetwork.EnableCloseConnection which defaults to false. This is a breaking change: Only if you set this to true, CloseConnection will work anymore. Updated: Library to 126.96.36.199. More details in changes-library.txt. v2.36 (20. September 2021) Updated: Realtime API. Check out changes-realtime.txt. Updated: Library to 188.8.131.52. More details in changes-library.txt. v2.35 (24. August 2021) Changed: CheckConnectSetupXboxOne() to allow AuthOnceWss and Datagram Encryption (GCM mode). It will set ExpectedProtocol and EncryptionMode silently. Datagram Encryption is only possible with a native plugin. Changed: Interest Culling in UtilityScripts/Culling/. Added: Rate limiting for interest group changes per second. No matter what the algorithm tells us, it makes sense to not change interest groups more than 4-6x per second. Changed: The GetActiveCells method to sort the "nearby" part of the cells list. This allows us to not change interest groups if just the order changed (due to "nearby" calculation, that could happen). Changed: The scene view grid now displaces the various area-indexes for cells that overlap (root, node and leaf). Note: Overall, the algorithm to select cells is just a quick showcase. It should avoid unsubscribing groups one by one and also avoid subscribing nearby groups one by one (while moving only along one axis of the areas). Fixed: A potential NullReferenceException for OwnershipUpdate events. If the PhotonView is unknown, this gets logged now. This is caused most frequently by loading scenes (or initializing them) without pausing the incoming message queue (dispatch). If ownership changed for objects, the Master Client will let new players know this but that failed, if the joining client didn't know the objects yet. Updated: Realtime API. Check out changes-realtime.txt. Updated: Library to 184.108.40.206. More details in changes-library.txt. v2.34.1 (28. July 2021) Updated: PhotonNetwork.PunVersion to "2.34.1" now. The previous version accidentally used "2.33.3" still. Updated: For Unity 2021, the obsoltete CompilationPipeline.assemblyCompilationStarted got replaced with CompilationPipeline.compilationStarted. v2.34 (26. July 2021) Changed: The PhotonView.Owner and .Controller for "room PhotonViews" will be changed properly whenever the Master Client switches. Room PhotonViews are identified by IsRoomView (which checks CreatorActorNr == 0). Changed: PUN needs to exit play mode in Editor, if there is a recompilation (due to code change, etc) to prevent running into endless NullReferenceExceptions and a flood of other errors. As the connection can't be held up after recompile, this is no big step back. The log will include a hint why the client exited playmode. Changed: The PhotonNetwork constructor creates a NetworkingClient (in Editor) to avoid exceptions due to possible recompilation. Changed: PhotonNetwork.StaticReset was running as RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad) but will run earlier now, using AfterAssembliesLoaded. Updated: Library to 220.127.116.11. More details in changes-library.txt. Release History All updates are detailed in the changelog.txt in the package. Download PUN 2 in the Asset Store Special thanks go to Jean, Vadim, Davin, Leepo, Hamza and Olli for their great work, feedback and support. Upcoming PUN is in Long Term Support (LTS) mode, which means we will support it for existing projects and keep it compatible with existing platforms. Of course, we keep the Photon Cloud compatible, too. However, bigger changes are no longer planned for PUN 2 anymore. We are working on the final pieces of Photon Fusion, our state of the art, MonoBehaviour-based networking solution. Fusion is recommended for all recent and new projects. Feedback is welcome! Just reply here. Mail us for complicated topics and console support. This post will be edited over time with more info, updates, etc.