Photon Unity Networking Get it. No server setup needed - runs in the Photon Cloud. Includes a free plan - no obligations. Exports to all major platforms. 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, authentication integration, matchmaking, first-class 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 v5.3 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. 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: email@example.com. Release History (recent releases) v2.8 (15. March 2019) Changed: Unity 5.6.6f2 is now the minimum supported version. Older versions won't run in the most up to date MacOS anymore, so we decided to drop those. Added: VIVEPORT Authentication provider. See: https://www.photonengine.com/en-us/viveport and docs: https://doc.photonengine.com/en-us/...d-authentication/authentication/viveport-auth Changed: The cached "best region" is cleared whenever a region's pinging finishes. This fixes a potential issue when the BestRegion value is used before the pinging is done. Then, you end up with a wrong selection. Added: When connecting to a Master Server directly (likely a Photon Server / OnPremise) without a UserId, PUN will now set a GUID. This reflects the behaviour of the Photon Cloud and helps differentiate clients by a UserId in matchmaking. Changed: When connecting to a Master Server directly (likely a Photon Server / OnPremise) with WebSockets, PUN now automatically uses a compatible serialization protocol (GpBinaryV16). Changed: The callback OnRoomPropertiesUpdate is not called when/before entering a room. It was called whenever properties change, which is also the case when the Realtime API constructs the room (with properties). Wait for OnJoinedRoom and check properties the first time when that's called. Updated: Photon3Unity3d.dll library to 126.96.36.199, rev5023. v2.7 (13. February 2019) Fixed: Offline mode. Custom properties are now set properly. Renamed: PhotonNetwork.BackgroundTimeout is now PhotonNetwork.KeepAliveInBackground. Fixed: PhotonNetwork.KeepAliveInBackground now sets the ConnectionHandler.KeepAliveInBackground, which actually affects the background keep-alive. Fixed: A crash problem on Nintendo Switch. Setting a Thread.Name caused a crash in some Unity exports. We work around this by simply not naming internal threads. Updated: Photon3Unity3d.dll library to 188.8.131.52, rev4985. Photon Chat: Added: Client API for Max Subscribers and Publish Subscribers features inside public channels. v2.6 (25th January 2019) Fixed: Offline custom properties are now set even if ExpectedProperties is set, as there is only one source for setting properties when in offline mode. Fixed: Switching Offline mode off now properly cleans up room content. Fixed: Infinite for-loop when enabling all Interest Groups by using new byte as parameter for the SetInterestGroups function. Fixed: The PhotonView attribute AddComponentMenu could not have a shortcut (in 2018.3) for unknown reasons. It was causing compile errors in some cases, so the shortcut (&v) is gone. Fixed: Rpc list was not showing in the ServerSettings Inspector. Fixed: Inspector for ServerSettings no longer closes due to recompile. Added: Tooltips for all fields in the Photon Server Settings. Each entry is now at least somewhat explained. More in the docs. Changed: PhotonNetwork.WebRPC can set AuthCookie webflag, which is used for WebHooks. Changed: PhotonNetwork.CurrentLobby and LoadBalancingClient.CurrentLobby are now readonly. The lobby must be defined by joining one or via the parameter when creating rooms. As before: You don't have to join a lobby to do matchmaking via a lobby. Changed: SupportLogger now makes use of the new ServerIpAddress value in the PhotonPeer. Changed: Added a local timestamp to the SupportLogger: it now logs [Time.unscaledTime] in front of each log. Changed: SupportLogger will also log the "basics" when it got the RegionsList from the Name Server (and it now logs the NS IP-address). Changed: The log output when Join/Create failed. Now it also logs the State (which is the primary value for IsConnectedAndReady). Better for debugging. Changed: PhotonNetwork.time is now cached per frame (based on Unity's frameCount value). This applies the same time-value for the whole frame, no matter when Update() gets called on a specific object. This might avoid some judder when syncing objects. Changed: The property "timestamp" is obsolete (as name) in PhotonMessageInfo. There is now a SentServerTimestamp integer and a SentServerTime double. It makes sense to use the integer to calculate delta-times in milliseconds. Added: Callback OnDisconnected() to connection-exception handling for "Exception in Receive". Also for: "Max CCU Reached" (probably not used). Added: Note in reference doc, that "Exception" for receive is typical if you connect a local Photon on Windows but the server isn't running/available. Fixed: SetInterestGroup() for Offline mode. If offline, it can simply skip the call to OpChangeGroups and avoid some log spamming. Added: ServerSettings now let you open the dashboard directly for each types of ids, and let you open the whiteList region editor as well. Fixed: PhotonEditorUtils.IsPrefab() is fixed for 2018.3 onwards, it now takes in consideration both assets and prefab editing stage when checking. Changed: Setting PhotonNetwork.PrefabPool to null now logs a warning and default to the DefaultPool class. Fixed: Problems with "Best Region" selection on Nintendo Switch. Best Region now works, even if all available Photon Cloud regions need to be pinged. Internal: PingMono class now keeps one Socket instance until discarded. Internal: PingMono uses Socket.Poll() now, instead of .Available (which might also be the cause why this is Switch compatible now). Internal: PUN now sends PhotonView-updates via a re-used List<object>. A second list was added to the PhotonView, so they can be used alternating and without copying values before sending them. Changed: ExecuteRpc() to not always create argument- and argument-type-list. This is a minor optimization. Changed: ExecuteRpc() check of arguments versus a method's parameters. Changed: RPC() to re-use the event-content Hashtable (and clear it instead of re-creating it every time). Updated: Photon3Unity3d.dll library to rev4954. PUN Classic v1.94 (13. February 2019) Fixed: A crash problem on Nintendo Switch. Setting a Thread.Name caused a crash in some Unity exports. We work around this by simply not naming internal threads. Updated: Photon3Unity3d.dll library to 184.108.40.206, rev4985. PUN Classic v1.93 (17. January 2019) Fixed: Support for 2018.3 and newer prefab editing workflow. Fixed: SetInterestGroup() for Offline mode. If offline, it can simply skip the call to OpChangeGroups and avoid some log spamming. Fixed: RPG Movement Demo. It was all-black in the last version, it seems. Updated: To Photon3Unity3d.dll v220.127.116.11, which is the same as used in PUN 2 with several performance improvements. See plugins\release_history.txt. Added: PhotonPing classes for the Best Region feature. They are not part of the used dll anymore (see below). Updated: SocketWebTcp.cs to match the new photon dll. It's now only compatible with Unity 5.3 and up. Photon Chat: Added: Client API for Max Subscribers and Publish Subscribers features inside public channels. PUN Classic v1.92 (26. October 2018) Updated: Removed "UsePreciseTimer" option and made it the only way to maintain time. Fixed: Issue with TextField in GUIFriendFinding, which wasn't used correctly. Fixed: RoomOptions.CleanupCacheOnLeave not synchronizing properly, if a PUN Client joins a room, which has been created by another SDK Client (i.e. DotNet SDK). This resulted in objects not getting removed properly, after the client has left the room. Added: Reloading a level is not taken into consideration when PhotonNetowrk.automaticallySyncScene is turned on and will trigger a level reload on all client Updated: To Photon3Unity3d.dll v18.104.22.168, which contains a fix for the Runtime 4.x Mono. See plugins\release_history.txt. Release History All updates are detailed in the changelog.txt in the package. Download Asset Store Special thanks go to Jean, Vadim, Leepo, Hamza and Olli for their great work, feedback and support. Upcoming Support for more platforms, more useful components and lighter networking. Known Issues When you load a new scene, all instantiated GameObjects are destroyed only locally but not on the server. Anyone who joins the room later on still creates those GOs. To work around this, PhotonNetwork.Destroy your instantiated game objects before loading a new scene. Or use: PhotonNetwork.RemoveAllInstantiatedObjects(player). Changing the group of a PhotonView is only done locally and not synced. If you Instantiate a new object in a group that wasn't subscribed first, then the local client won't create the GameObject (it is culled by Interest Group). When you use multiple scenes, the viewIDs of PhotonViews in those scenes will always start at 1. Edit the PunSceneSettingsFile in your project to enter a minimum ViewID per scene if needed. Feedback is welcome! Just reply here. This post will be edited over time with more info, updates, etc.