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.69 (19. May 2016) Updated: PUN+ native socket library for Unity 4.7 iOS to support IPv6. PUN Free and PUN+ support IPv6 on all iOS exports that have Unity IPv6 support. PUN+ enables IPv6 even in Unity 4.7.1. Updated: Rock Paper Scissors Demo Scene, featuring fixes for timing and turn management, and implementation of a progress bar to indicate timer v1.68 (3. May 2016) Updated: Rock Paper Scissors Demo Scene, feature many clean up and fixes, as well as needing only one scene now. Fixed: The "reset" action of a PhotonTransformView-inspector now works as expected and sets proper, useful default values. Fixed: PhotonAnimatorView. Layers in Unity 4 where not counted properly, it now lists layers properly. Fixed: Buffered RPCs can be removed (as expected) from the buffer with RemoveRPCs(). Affected versions were v1.66 and v1.67. Please update those. Updated: The docs (.chm and .pdf). v1.67 (21. April 2016) Fixed: Photon Chat for WebGL export. It failed to compile because SocketWebTcp was not found. The PhotonChatApi folder now got moved from Assets\Plugins to Assets. Changed: If sent by server, UserId and Nickname values are updated (with the server's values). This can be done with CustomAuthentication. All clients always get some UserId assigned by the server (if you didn't set one in the first place). Added: "Slot Reservation" as feature for matchmaking. Added: ExpectedUsers parameter in PhotonNetwork methods: CreateRoom, JoinRoom and JoinOrCreateRoom. Added: Room.expectedUsers. List of users who are expected to join this room. In matchmaking these UserIDs block a slot out of the MaxPlayers. Added: RoomOptions.publishUserId. This tells the server to publish the UserIds of players in a room. You can use those in FindFriends or when you join/create another room, to reserve slots for other players. Added: PhotonPlayer.userId. If the server publishes the UserIds of players, you can access the UserId here while being in a room with others. Internal: Added GamePropertyKey.ExpectedUsers (247) and ParameterCode.NickName (202). Added: PhotonNetwork.StartRpcsAsCoroutine as optional performance improvement. If set to false, PUN will not attempt to start and RPCs as coroutine. While coroutines are efficient, starting them needlessly is not the best approach either. This defaults to true, which means RPC methods get started as coroutine, if they return IEnumerator. Changed: Internal handling of RPC methods. Now their parameter list is being cached, instead being fetched every time we have to find an RPC. This uses a limited amount of memory to improve speed of RPCs. To do this elegantly, we extended MethodInfo with a GetCachedParemeters() method. Changed: AccountService is now wrapped in "#if UNITY_EDITOR" to avoid export to any players. Added: RoomOptions.PlayerTtl, which can be used when creating a room. If set, a player who disconnects becomes inactive for the defined time, instead of being removed from the players list. This allows the player to join a room. It blocks the player's slot in the room in matchmaking, too. Added: PhotonPlayer.isInactive. If a Player Time To Live is set, players can become inactive in a room. The PhotonPlayer instance is still present, as if the player were connected. Added: A client which lost connection, can now rejoin a room quite easily with PhotonNetwork.ReJoinRoom(string roomName). Important: To enable this, a room must have a PlayerTtl != 0 and the client which is rejoining, must use the same UserID as before. Fixed: The State of a client when it fails to join/create a room on the Master Server. It's now set correctly to either PeerState.JoinedLobby or PeerState.ConnectedToMaster (depending on whether the client was in a lobby or not). Fixed: The "Open Dashboard" button in the PUN Wizard, which was not working on OSx. Updated: Usage of EditorUtility.SetDirty() and Undo.RecordObject() in Editor scripts according to Unity 5.3 changes. This should enable undo in most Inspector windows, too. Changed: PhotonNetwork.BackgroundTimeout no longer calls Disconnect() directly. Instead a normal timeout period is granted after the BackgroundTimeout elapsed. PUN will use the common timeout callbacks (when the app gets active again). Changed: PhotonNetwork.BackgroundTimeout now defaults to 60 seconds. This keeps all new apps from being connected for longer times in background but allows loading lots of assets and taking short calls, etc. Changed: Usage of SupportClass is now SupportClassPun to avoid clashes with IL2CPP on some platforms. Added: RoomOptions.plugins to define which server-side plugins are expected. This is a feature of the Enterprise Cloud and when using the Photon Server SDK (so it's not available in the Public Cloud). Added: Handling of an "Info Event", which could be used by server-side plugins. EventCode.ErrorInfo is code 251 and PUN will call the delegate you defined in PhotonNetwork.OnEventCall (or log a warning that no delegate was set). This only applies to customized servers (not the Public Cloud). Added: PhotonNetwork.ReconnectAndRejoin() to be used when a client loses connection while in a room (e.g. when you press the lock button on iOS and then return to the app). Added: PhotonNetwork.Reconnect() to be used when a client lost connection. Use this only when your client was connected to a region or a game before (to get into the same region). Fixed: A compile warning about Photon.MonoBehaviour.networkView "does not hide an inherited member" in Unity 5.3.4 and up. The old networking API of Unity is being removed, it seems. Fixed: PhotonNetwork.time for offline mode. Internal: It now uses the Environment.TickCount, which is similar to the server's timestamps. All usage of time in PUN is now either based on PhotonNetwork.time or .ServerTimestamp. Added: UtilityScripts\InRoomTime.cs as sample component how to establish a synchronized timer which starts at zero and goes up. This is only working in-room. Known Issues: Forgot to update the generated docs. Will update. Release History All updates are detailed in the changelog.txt in the package. Download Asset Store Special thanks go to Jean, Vadim, Leepo and Olli for their great work, feedback and support. Thanks also to Caitlyn and Team for getting this live incredibly fast Upcoming A brand new tutorial (replacing Marco Polo) and a new demo for re-joining games quickly to recover from connection loss. 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.