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 v3.5.7 or up. Export to Standalone, Web, Win 8 Store, Win 8 Phone with Unity Free. Export to Android and iOS can be done with the PUN+ package or "Unity Pro" licenses for mobile. As server use either Photon Cloud Service: www.exitgamescloud.com Free for 20 concurrent users. Photon Standalone server: www.exitgames.com/Download/Photon Free 100 concurrent users (CCU) license. Registration required. v1.26.1 (12. August 2014) Added: Demo Pickup! Simple soltion for picking up items in a game. It also has Teams and Scores per player. Some of it is "work in progress" but it should give you a base to extend. Changed: PUN now uses Photon's "Name Server". Per AppId and region, it returns the Master Server's address to use. This allows us to dynamically move games if we have to. Changed: Best Region selection. It should now be supported on all platforms that PUN runs on, too. Changed: NetworkingPeer.AvailableRegions is now a List<Region>. It can be populated when connected to the NameServer. When the list is available PUN can send pings to each server and find the best. Added: Enum CloudRegionCode to be used for Regions. This defines the regions typically available and "none", if no region was set. It's no longer just a string (but we do use the value's name). Added: Hosting type "BestRegion" which makes the client ping available regions one time and then store the best in the PlayerPrefs. Wait time is minimized that way. Changed: PhotonNetwork.Friends is now updated when the server's response becomes available (not on request). This avoids cases where the friends are offline for the moment between requesting the update and getting it. Initially, it is null as before. Changed: PhotonNetwork.Friends is now a List<FriendInfo>. When you fetch your friend's info, PUN will keep the current list until it got the reply from Photon, then it will replace the current list completely. If you fragment your friend list (because it's very long), you should take care of storing partial updates into some "complete" list yourself. Still, FindFriends blocks further requests until the response is read. Fixed: Initialization for Room.autoCleanUpField which has to be false by default, even if a PhotonNetwork.autoCleanUpPlayerObjects is true. It defaults to false unless explicitly set to true per room. In v1.25, this could make clients clean up, even if the room-setting (set by just one user) was false. Fixed: A wrong internal state which treats the initial connect differently to provide help in the logs. Fixed: How PUN internally re-connects from the new NameServer to connect to the assigend Master Server. As the new technique is not yet used, this did only affect a few select clients. Changed: Enabled a shortcut for authentication. A server might now summarize our initial authenticate into an encrypted secret for the client. If that's available, the client can send this instead of encrypting the original values again. This speeds up connecting minimally. Internal: Updated some constants and descriptions. Added: PhotonHandler.AppQuits which is set in OnApplicationQuit. Helps PUN with app-quits where we never want to re-connect (not even by a clever re-connect script). Changed: Connect*() will check of AppQuits is true and skips connecting if so. Changed: PhotonHandler has a OnApplicationQuit() method which will always immediately stop all Threads of PUN. This stabilizes some issues we had in the Editor. Fixed: LobbyType enum had a wrong value for Default Lobby. If you wanted to create multiple, named lobbies that behave like the default lobby, the server wouldn't provide you room lists as expected. This is now working. Updated: Description how to redeem a PUN+ code in readme.txt. Added: OnJoinedInstantiate script (in UtilityScripts folder) for easy-peasy instantiation of prefabs on join (common task). Added: Interface IPunObservable as definition of OnPhotonSerializeView with parameters. Refer to enum PhotonNetworkingMessage and it's values to find the callbacks PUN uses! They are described and you get an example how to use them. Added: PhotonPlayer.GetNext() and .GetNextFor() methods. Those are useful when you want to find the next best player, in relation to another. The one that's next after the Master Client or after yourself. Added: PhotonPlayer.TagObject. It could be used to keep any object which you need in relation to a player. This is not synced automatically! You have to setup relations manually. Added: PhotonPing class as base for different ping implementations. Changed: Photon.MonoBehaviour now explicitly ExitGames.Client.Photon.Hashtable. Internal: PhotonHandler now does some of the work that PingCloudRegions did before. That was a separate Component which is no longer needed really. Internal: PhotonPingManager uses the new PhotonPing class to ping regions several times. Each region gets it's average ping time set. Added: Support for Photon Cloud "Region Pinging" on Windows 8 Store, Windows 8 Phone and Linux. Internal: PhotonHandler disconnect from NameServer when pinging. This avoids threading issues in native lib. Changed: ConnectToBestCloudServer() is now in all platforms (but not sure if it works). Added: PlayerScores script. Really just a few extensions to the PhotonPlayer actually. Added: Sample script that turns a pickup into scores. Implements another event method. Added: Drop(pos) for PickupItem. This allows you to drop an item anywhere! Yay! Added: PickupItemSyncer script which is a temporary solution for sending the pickup item state to incoming players. At the moment, we don't guarantee it's 100% working but you get the idea and can adjust the thing. If no players can join while things are picked up, then this script is not needed. Note: The PickupItemSyncer is known to be slightly imperfect. There are rare conditions when a player joins and the state is not synced correctly. We are working on a server-side solution, so this is a) temporary and b) an idea how to solve things right now. Updated: Settings inspector. Options are per hosting type. Added protocol. Updated: Wizard accordingly. Changed: For settings, the server address does not have to contain a port. Using defaults. Added: NetworkingPeer.ProtocolToNameServerPort and made use of it. Added: Pickup Demo to Hub and pun-demo-build setup. Fixed: In offline mode, Room.SetCustomProperties and PhotonPlayer.SetCustomProperties will not actually try to send the properties. Instead, they are updated locally and the callback get called (See PhotonNetworkingMessage.OnPhotonPlayerPropertiesChanged and PhotonNetworkingMessage.OnPhotonCustomRoomPropertiesChanged). Changed: OfflineMode now uses an internal Room instance which is created in JoinRoom or CreateRoom and set to null on LeaveRoom, Disconnect and when you set offlineMode = false. It can be used to store properties (only locally!). Added: PhotonNetwork.SetReceivingEnabled(int enableGroups, int disableGroups) to change multiple interest groups in one call. Added: PhotonNetwork.SetSendingEnabled(int enableGroups, int disableGroups) to change multiple interest groups in one call. Added: Extensions for handling active and SetActive independent of Unity-version. This makes our demos compatible with Unity 3.5.7 and up without using absolete code. Added: Ability to send WebRPCs. Check out PhotonNetwork.WebRpc method. Added: Class WebRpcResponse (in file PhotonClasses). Added: Callback OnWebRpcResponse (see: PhotonNetworkingMessage.OnWebRpcResponse for details). Added: Error messages on-screen in the "Worker Demo" menu. When CreateRoom, JoinRoom or JoinRandomRoom fail, there is a temporary notice. Not beautiful but you get the idea. Added: ShowInfoOfPlayer component (in UtilityScripts folder). It's an example how to display the owner's name of networked GameObjects (those with PhotonView). Note that the owner might be "" if you don't set a PhotonNetwork.playerName. Best set it before/at connect. Added: SupportLogger component (in UtilityScripts folder). Attach to any GameObject in a start scene and it will vital values we need when you have support-questions about your subscription, your CCU usage, etc. We might ask you to run your game with this script. Send the log or at least the output starting with "SupportLogger Info" in doubt. Added: InRoomRoundTimer component (again: in UtilityScripts folder). It is a simple synchronized timer for rounds. Players who join late can still count down to the end of a round, etc. Check out the code and usage and you should be able to implement state changes on top of this. Added: ErrorCode.WebHookCallFailed (32752). This can happen when you accidentally use a Turnbased or Chat ApplicationId. It just makes sense to know and maybe check AppID. Added: LogError for Operations that failed in a WebHook or Server Plugin. This should make it relatively easy to spot situations where an AppId is misconfigured on the server. Added: Optional object parameter for OnPhotonRandomJoinFailed, OnPhotonJoinRoomFailed and OnPhotonCreateRoomFailed. It makes debugging easier. When your callback has this parameter, you get ErrorCode and the debug message. You don't have to implement this new parameter though. It's only interesting in a few cases. Changed: RaiseEvent can now send events with code 0..199. They also get dispatched when you registered a OnEventCall. Before, eventCode had to be 1 and up which was a unnecessary limitation. Added: Description for all RoomOptions. Changed: The RPC-List is now sorted when new ones are added. On refresh, the whole list is sorted, which is more likely to be the same across Editors. Added: HashCode for RPC-List so you can (more easily) compare them across Editors. Added: Commented-out potential solution for OfflineMode RPCs which go to all via server. Updated: Reference documentation. PhotonNetworkingMessage is now well documented, PhotonView.RPC and some others are improved. Also the organization of "General" topics is improved. Changed: When setting offlineMode to true, PUN now directly calls OnConnectedToMaster. This is the same workflow as if you go online but not into a lobby. There won't be any room-listing in offlineMode, so this hopefully makes sense. Fixed: Nullreference Exception on import (due to ServerSettings RPC List). Updated: Lots of reference/api documentation. Check out the .chm file which is the preferred doc type now. Updated: To latest Photon Unity dll v22.214.171.124. Release History All updates are detailed in the changelog.txt in the package. Download Asset Store Special thanks go to Leepo for his great work on the implementation, feedback and support. Thanks also to Caitlyn Team for getting this live incredibly fast Upcoming Support for Unity 5 and WebGL player. Photon Chat for room-independent messages, friend status and more. 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. When you use multiple scenes, the viewIDs of PhotonViews in those scenes will always start at 1. Different scenes have different objects but use the same ID. This can clash if you don't sync level loading. Feedback is welcome! Just reply here. This post will be edited over time with more info, updates, etc.