Photon Unity Networking Get it. No server setup needed - runs in the Photon Cloud. No obligation due to free plan. Download from the Asset Store: http://u3d.as/2ey Overview This package implements Unity's well known networking API on top of Photon. Keeping the API simple, this gives you standalone, dedicated servers, fixes, tweaks and ongoing support. This "plugin" 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 v4.7 or up. Export to Standalone, Web, Win 8.1 Store, Win 8.1 Phone, UWP and more. Unity 5 exports PUN Free also to Android and iOS. Unity 4 exports to Android and iOS with the PUN+ package or "Unity Pro" licenses for mobile. 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. v1.80 (15. December 2016) Fixed: PhotonTransformView first take routine to take in consideration what to update instead of forcing position, rotation scale no matter what. Updated: PlayerRoomIndexing.cs to account for potential race conditions when masterClient is transfered and new player joins. SanitizeIndexing() is now in place. Fixed: Fix ownership management for scene objects when MasterCLient is/was changed. Updated: Chat demo, with new Friend Status update and message implementation available in the Interface as a friends' List. Added: "Best Region" support for WebGL exports (uses http to measure roundtrip times). This will require a server-side fix for CORS, coming in January. Working preliminary. Fixed: JoinRandomRoom() will now correctly send ExpectedUsers to the Game Server (if any were set in the RoomOptions). This fixes issues when you wanted to reserve slots in a room for other players. Added: A null-reference check in FindGameObjectsWithComponent(), which could fail in rare cases otherwise. Changed: Setting RunInBackground is now done in the PhotonSettings file. It's enabled by default but in a few exports, this could lead to issues. Added: The internal "AuthEvent". This event by the server can now update the client's token anytime (before that expires). Good for longer play sessions. Removed: Surplus debug log output. Changed: Public variable- and property-naming to PascalCase (beginning with an uppercase character) in RoomInfo, Room and PhotonPlayer class. The old naming is still available but attributed as Obsolete, so you should update asap. Sadly, this is extra work for everyone but we want to make the API more stringent. Changed: The PhotonPlayer.name is now .NickName to make it more obvious that this is not the user's ID (and might be changed at will). Removed: Obsolete PhotonView.observed. Since a while, each PhotonView has a list of observed components instead. If you have a very old (!) project, check your PhotonViews and make sure they still observe the scripts you meant to observe. Newer projects won't be affected. v1.79 (18. November 2016) Changed: PUN will no longer aggregate the data from ALL objects in a group into ONE message. Instead, a maximum of 10 objects will be sent together. The idea is to avoid huge messages, which need fragmentation. Fragmentation needs to be avoided, because fragments are always reliable (and you basically lose "unreliable" updates when you send too much). There is a new variable for this: NetworkingPeer.ObjectsInOneUpdate. Changed: As we send max 10 gameobject-updates in one message (by default), we can use a byte as type for their ID (instead of short). This minimally saves data but makes this PUN incompatible with older builds. We separate PUN versions for you so there won't be a clash. PhotonNetwork.versionPUN is inserted into your Game Version to separate players. Updated: PunTeams to keep PlayerPerTeams Listing up to date. Updated: PlayerRoomIndexing improved consistency across various network contexts. Fixed: SocketWebTcp for WebGL was time scale dependant and would stop receiving events when Time.TimeScale = 0. Updated: DemoChat UI reworked to match demo Hub look and feel. Updated: DemoHub pixel Perfect Canvas fix. Added: Two more regions: Korea, Seoul (kr) and India, Chennai (in). If you're using the hosting option "Best Region", you may want to update the configuration in your PhotonServerSettings file. v1.78 (1. November 2016) Fixed: NetworkingPeer ownership assignment on late join when MasterClient is involved. Fixed: SetTeam() (in PunTeam) now assigns the team to the target player, instead of the local one. You could use the extension method on any PhotonPlayer (not only on yours). Fixed: PlayerVariable.cs material assignment to take MasterClient as a special case and avoid color mixup. v1.77 (24. October 2016) Changed: Transfer Ownership requests are now handled a little different. For "takeover", any player's request is successful if taking from the correct, current owner OR when taking from the master client (even though the owner is technically the room). E.g.: You can takeover from actor 1, even when clients registered the object's owner as 0 (null is used for "the room", which is equivalent to "belongs to master client"). Fixed: late joining would not be aware of ownership transfers. Now owner is matching who sends events. Updated: The Photon "Demo Hub" to the new uGUI. Setup demos by "Window" -> "Photon Unity Networking" -> "Configure Demos (build setup)" to get all demos in a build. Fixed: Chat and RPS demo when going back to the demo hub would throw errors, this is corrected now. Fixed: PhotonViewInspector not setting target to dirty when editing ownershipTransfer Changed: The "Background Thread" in PhotonHandler will only call SendAcksOnly(), if Update() didn't recently (last 200ms). This makes sure that timeouts are not affected by the background thread (which keeps the client side from timing out for a while). Fixed: PhotonTransformView DoDrawEstimatedPositionError was not taking in consideration parenting. Fixed: The RoomOptions.EmptyRoomTtl got set if only PlayerTtl was > 0. Now both values are fully independent. Note: To allow the last player to come back to a room after a disconnect, you need to define a EmptyRoomTtl. Else, the room gets cleared when the last player leaves or becomes inactive. Updated: Api reference for FindFriends, AuthenticationValues. It should be clearer how the userId is set (and if the playerName gets used at all). Fixed: An issue in NetworkingPeer.NewSceneLoaded(). It did not clean up correctly in v1.76 on loading scenes. Updated: PhotonNetwork.BackgroundTimeout. It's now disconnecting (not timing out) and the doc got updated for that. v1.76 (21. September 2016) Fixed: Compatibility with ".Net 2.0 Subset". This can be used again. Updated: Some minor things to support Unity 5.5 beta. As always, this is work in progress. Let us know if you run into issues. Fixed: Values in enum DisconnectCause are now assigned with the ones from the lower level StatusCode, so that the values make sense again. Fixed: NetworkingPeer ReconnectAndJoin procedure by not cleaning up Ip Address on disconnection. Added: RoomOptions EmptyRoomTtl are now available. You can set how long a room stays in Photon Server's memory before it's being cleaned up or saved/persisted. Improved: Remove initial drifts on remote PhotonView transform values for ThirdPersonNetwork and PhotonTransformView components. When using these components, the first "life update" defines the position of a GO (instead of lerping there from the instantiate-position). Updated: The Chat Demo. It has a new text-input command and shows channels and private conversations properly. Updated: To Photon assemblies v126.96.36.199. which includes a fix for WSA builds. Also, only one WSA compatible dll is used across Windows Store exports (8.1 and 10). v1.75 (23. August 2016) Fixed: The Photon assemblies (.dll) to support IPv6 correctly again. This was broken temporarily in v1.74. Fixed: UWP assembly. It now contains Photon's Hashtable, as all other libraries do. This fixes Windows 10 UWP exports. Changed: PhotonMessageInfo is now a struct (was a class). This is less garbage to collect. Changed: Demo script "ColorPerPlayer" to use less resources. When entering a room, it ignores property-changes until an initial check is done "on join". Changed: Internally, the ServerSettings class now contains a VoiceAppId field. This allows easier merging with PUN Voice. Changed: Internally, OnSerializeRead() now re-uses a stream object and just applies new, incoming values to it. This saves a bit of garbage. Fixed: Compatibility with Unity 5.4, where OnLevelWasLoaded is obsolete and SceneManagement.SceneManager.sceneLoaded should be used to register "on loaded" callbacks. Updated: To Photon assemblies v188.8.131.52. v1.74 (15. August 2016) Fixed: PUN+ is now compatible with Unity 4.x Free again and can export to iOS and Android as expected. If you have Unity 5.x or 4.x Mobile Pro, you were not affected. Fixed: TCP Socket for Windows Store 8.1 and UWP. Changed: Due to upcoming new encryption options, exports now must use API Compatibility Level ".Net 2.0" instead of ".Net 2.0 Subset". We hope this is a minor issue. Let us know if not. Note: When the Bytecode Stripper fails, see the note above about Compatibility Level. Added: Optimization if a observed component implements IPunObservable. If so, we use a shortcut to call OnPhotonSerializeView(). This can speed up observed component calling in PhotonViews. Fixed: NetworkingPeer.HandleEventLeave() inactive state missing masterClient assignement during first leave call (A second leave call will be made after playerTtl expires). Improved: DemoChat : Exposed FriendsList to the inspector to prevent hardcoded friends references, and allow for easier testing without code modification Fixed: PhotonEditor.cs: Pun+ plugins libs paths discovery. For Unity 4.7.2, the wizard window detect PUN+ correctly again. Internal: Changed the workflow for setting up protocols. One method aggregates this now. Internal: NetworkingPeer.SetupProtocol(). Gets called before each PhotonPeer.Connect(). Changed: PhotonNetwork constructor no longer sets protocols for special cases. Updated: The IPhotonSocket implementations to set their "IPv6-resolved" state. Updated: To new library build with new internal workflow for the "Init Request". Improved: PhotonPlayer.cs: Implemented IComparable and IEquatable. Fixed: NetworkingPeer.cs: Check for null view before adding view's GameObject. Fixed: Room.ClearExpectedUsers() is now sending it's current, local "expected users" to update the server with "CAS" (Check and Swap). This gives the client an update when the values become valid (which updates the local cache after the roundtrip). Added: link.xml file to preserve some classes from being stripped. This is in Assets\Photon Unity Networking\. Changed: The name/string of the "OnPhotonInstantiate" callback is now cached once, instead of using enum.ToString() each time. This is a minor performance improvement. Changed: The initial Dictionary size used in a PhotonView. This stores the the observed components and their methods to call. Fixed: Compatibility with Unity 5.4 by not adding a MonoBehaviour as Component. Instead, a derived class is used. 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. Thanks also to Caitlyn and team for getting this live incredibly fast 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.