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.3.4 or up. Export to Standalone, Web, Win 8 Store, Win 8 Phone with Unity Free. Unity 5 exports PUN Free to Android and iOS. Unity 4 exports to Android and iOS with the PUN+ package or "Unity Pro" licenses for mobile. iOS-64bit support requires at least Unity 4.6.3p2. 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.60 (30. July 2015) Added: PhotonNetwork.EnableLobbyStatistics to enable/request statistics about lobbies and .LobbyStatistics as list of lobbies (available while on the Master Server). The list of lobbies is provided as a list of TypedLobbyInfo per lobby, which wraps room- and player-count per lobby (so you can find the active ones). Added: Callback OnLobbyStatisticsUpdate(). Implement this to be notified when new lobby statistics become available (to update your UI, etc). Added: PhotonNetwork.QuickResends, which controls a new feature. For reliable messages that got lost, the first few repeats can be done quicker. This improves connection reliability and reduces gaps in case of loss. Only up to 3 resends can be quick. Read the doc! Changed: Some PhotonNetwork fields that didn't have to be public are now internal, as intended. Updated: Api reference for PhotonNetwork.playerName, .SendMonoMessageTargetType and .automaticallySyncScene. Also for enum CloudRegionCode and ServerConnection and class WebRpcResponse. Changed: PhotonNetwork.gameVersion is now a auto-property field (and no longer sets a private field). Internal: Removed NetworkingPeer.mAppVersion. Changed: Some "per project" settings are now being moved into the PhotonServerSettings file. Currently, this can be used to set: Auto-Join Lobby, Enable Lobby Stats. Feedback welcome. Changed: Order of updating internal values when joining a room. The actor list is now updated before we do callbacks. This cleans up a reference to our local "dummy" player before we do the "joined" callback. Fixed: The inspector no longer attempts to update a PhotonView "observed" field to a list while the game is running. This led to ArgumentOutOfRange exceptions (while inspecting at runtime). Changed: The ChatGui class now contains a Instance field, which you could use from other scripts. It's supposed to be a singleton and to persist across loading levels (which is why it will apply DontDestroyOnLoad() to it's GameObject). Changed: ChatGui now also disconnects when it's GameObject gets destroyed (OnDestroyed()). Fixed: ConnectUsingSettings, ConnectToBestCloudServer and ConnectToRegion will only work while the client is not connected. In doubt, use Disconnect() first. Changed: When the PhotonHandler gets destroyed, it now cleans up the background thread which usually keeps the connection. This hopefully avoids rare freezes of the Unity Editor when closing. Changed: When switching the protocol, the networkingPeer is being replaced. Now we apply the previously set disconnect timeout to the new one. Updated: To Photon Unity Assemblies v18.104.22.168. Fixed: The logical order of assigning a player number when turning on OfflineMode. The callback OnConnectedToMaster be done with PhotonPlayer.ID being -1 but when you join or create a room, the client's PhotonPlayer.ID will be 1 in the callbacks. Changed: WebGL WebSocket.jslib. The socket.onmessage is now using an arraybuffer to read messages. This should be leaner and is a workaround for infrequent long read-times in Chrome. Skipped: v1.59 of PUN (used internally) Chat API: Added: IChatClientListener.DebugReturn(). This is a breaking change, if you use the interface. Photon lib and chat client log via this method (no logging to console by default). Changed: ChatClient.CustomAuthenticationValues is now .AuthValues. You can use those values to identify a user, even if you don't setup an external, custom authentication service. Changed: ChatClient.UserId no longer directly stores the id but puts it into AuthValues. This means, the UserId could also be set via setting AuthValues. Changed: The API of AuthenticationValues. There is now the UserId and AddAuthParameter() replaces the less general SetAuthParameters() (which only set specific key/values). Note: All users should have a UserId. You can set chatClient.UserId before you connect, or you can set the AuthenticationValues in Connect(..., authValues) to set a UserId. Added: ChatChannel.ToStringMessages(), which gets all messages in a single string, line by line. The format is "Sender:Message". Added: ChatClient.TryGetChannel() to find a channel only by name, no matter if public or private. v1.58 (30. June 2015) Fixed: Compile warning about last remaining reference to RPC attribute (in Unity 5.1) by suppressing the warning. This reference is only in the Editor scripts and works unless RPC gets removed. Removed: Native socket libs from Unity 5 PUN+ package. The native libraries are no longer useful and keep us from supporting more platforms that are covered by Unity. Using the Socket class in C# is no longer a Unity-license problem. Download from the Asset Store with Unity 5.x to get this package. In Unity 4.x, you still get the Android and iOS (32bit and 64bit) libraries. v1.57 (22. June 2015) Fixed: An issue with the RPC list update, which was still looking for the old RPC attribute. So when you switched over to PunRPC, the list was empty. Added: Automatic check if the obsolete RPC attribute is in source, to offer an automatic conversion to the new PunRPC attribute. Conversion uses search and replace for [RPC] to [PunRPC] and @RPC to @PunRPC. Added: PhotonNetwork.ConnectToRegion(), which enables you to connect to a specific region easily. This can be useful when you do your own region selection. Note: Best Region selection won't work in WebGL exports currently. A fix needs updates on the server side and is in work. Note: Chat API won't work in WebGL exports at the moment. Delete it from a project which targets WebGL. Note: PUN+ does not support WebGL at the moment. It requires an update of the lower level APIs which we work on. Unity 5 can export PUN Free to all platforms, so use this as workaround. v1.56 (16. June 2015) Changed: The RPC attribute got replaced by PunRPC. Search and replace your code for [RPC] and replace it with [PunRPC] (in JS: @RPC and @PunRPC). The change is necessary, because the RPC attribute is obsolete in Unity 5.1 and that causes a large amount of warnings at compile time. The new PunRPC must be used in all versions of Unity, starting with this PUN version. v1.55 (12. June 2015) Changed: PhotonNetwork.time so that it's always positive, even on iOS 64bit exports. Note: this time value does not start at 0 and it will "wrap around" from 4294967.295 to 0! Use with care - we will implement a better soltion asap. Changed: ServerSettings.EnabledRegions (for "Best Region" Cloud hosting) now defaults to "all". The old default had the same effect but it was labelled as "none" of the regions (which is not allowed). Fixed: Re-creation of the PhotonServerSettings file in case you deleted a duplicate. This always created a file in the default location. Now, it does not matter where the PhotonSettingsFile is: If you have one at least, it will be found. Changed: AuthenticationValues now has a property UserId. You can set a UserId independent from the playerName now. This UserId should be unique per player and does not have to be readable. FindFriends will use this UserId (or one set by a Custom Auth Service). If you don't set it, PUN will use PhotonNetwork.playerName to identify a user. Changed: AuthenticationValues now uses AddAuthParameter(key, value) to set parameters. Simply call it once for each parameter that your authentication service expects. Changed GUICustomAuth accordingly. v1.54 (3. June 2015) Fixed: In Offline Mode, the NetworkingPeer.mMasterClientId always returns the local player ID. This fixes RPCs in offline mode targeted at the Master Client. Fixed: WebGL support no longer breaks other platform exports. Download the package from the Asset Store with Unity 5 to get WebGL support (Unity 4 can't handle it). Changed: WebSockets are now only used for the WebGL platform (in-editor and in export). You can't select WebSockets on any other platform (because we can't support the websocket-csharp.dll on each). Added: When you select "Best Region" as Hosting Type (in PhotonServerSettings), you can now select the regions that are enabled. Deselect those you don't want to use and they are dropped from the list of available regions (in the client, obviously). Changed: Setup Wizard. It's now considerably leaner. The idea is to improve the Inspector for the PhotonServerSettings some more. Working but also "Work in Progress". Fixed: A bug when setting properties via SetCustomProperties(propertiesToSet, expectedValues). Those updates were not sent reliable, so they could get lost and de-sync with any clients. This only affects currently updated clients which used this new feature (since v1.52). Thanks, Lino. Release History All updates are detailed in the changelog.txt in the package. Download Asset Store Special thanks go to Leepo and Olli for their great work, feedback and support. Thanks also to Caitlyn and Team for getting this live incredibly fast Upcoming Better support for Windows Universal builds, a new setup wizard and better region selection. 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.