PUN 2 Change Log

v2.15 (19. September 2019)
Fixed: NullReferenceException when trying to log an error for a received RPC with a non existing method and zero arguments.
Changed: Calling an RPC method with a null or empty method name will not be executed and error will be logged.
Fixed: Callbacks deregistration and PlayersPerTeam clearing in PunTeams which caused KeyNotFoundException in some cases.
Fixed: NullReferenceException in SupportLogger.TrackValues in Unity Editor after compilation by making sure only one instance of SupportLogger is in the scene and SupportLogger.TrackValues is properly stopped when the application stops or client disconnects.
Changed: TypedLobby refactored to reflect the proper definition of the default lobby: a lobby that has a null or empty name, the provided type is ignored in this case and will be considered default type.
Changed: RPC methods not found error logs explictily state that RPC methods search does not include static methods which are not supported as RPC methods.
Updated: SceneSettings Inspector improved and SceneAsset field added to make reference to scenes easier.
Updated: Code comments for documentation.

v2.14 (9. August 2019)
Updated: To using Unity 2017.4.7 as lowest supported version. The Asset Store no longer supports uploading packets for older Unity versions. A few variables are now public, as they were not accessible otherwise due to assembly definitions.
Changed: The callbacks to OnDisconnected(reason). On timeout or exception, there is now only one callback which happens after the client/peer is actually disconnected. The peer's status changes (timeout, etc.) are used to identify the reason but don't cause a callback on their own. Previously, you could run into more than one OnDisconnected call and fail to reconnect in the first one.
Changed: There are now fewer calls of OnDisconnected(). Example: A timeout disconnect caused two calls because signalled the timeout and the second signalled when the client locally finished disconnecting. Now, the DisconnectCause stores the reason and there is only one callback.
Changed: Internal use of DisconnectCause. It's now set in LBC.Disconnect() and by errors from the Peer. It's reset to "None" before calls to Peer.Connect().
Removed: DisconnectCause enum values that were obsolete already. DisconnectByServerUserLimit is now MaxCcuReached. TimeoutDisconnect is now ClientTimeout. DisconnectByServer is now ServerTimeout.
Changed: SupportLogger. Traffic stats are enabled by default. The PhotonHandler no longer has to enable this.
Added: Min/max ping to logged statistics. SupportLogger.TrackValues is invoked to keep track of min/max ping for each connection.
Fixed: Statistics logging is started on Connect and stopped OnDisconnected().
Added: AssemblyDefinition for the Editor scripts of Demos (which have been one big assembly, including the Editor scripts).
Fixed: Basic Tutorial Player UI hiding system when player is not visible.
Added: Check to Connect methods to not connect, if the app quits. This was freezing of the Editor in some cases.
Changed: Callback registration.
Changed: All callback target changes are now queued in one queue and executed in order. This avoids cases where our implementation defined if a callback got added or removed, when a target got added and removed.
Changed: Duplicate addition and removal is now prevented.
Changed: The callback containers now know and use the LoadBalancingClient to update the targets. This means they don't need lists for additions and removals anymore.
Changed: Events will now also update the callback targets before executing the event callback.
Changed: WebRpcCallbacksContainer is now also a List<i> like the other containers. This is simpler to maintain. The only "custom" callback implementation is that for events. This was an event delegate before and remains one. No change for this.
Changed: PhotonViewIdHandler to keep assigned viewIDs if they don't clash. This avoids some issues when editing projects.The workflow now applies the minimum scene view ID for PhotonViews for multiple open scenes.
Changed: Editor usage of PUN.
Changed: PhotonEditor no longer uses the Editor update loop. It updates less frequently and more to the point with specific events.
Changed: The PhotonEditor is not using PhotonNetwork.PhotonServerSettings anymore, which could cause a freeze of the Editor.
Fixed: The PhotonEditor could fail to load the PhotonServerSettings when loading a project without "library" folder in Editor 2019. This showed as a lost app id, even though the project had one earlier.
Fixed: UpdateRpcList failed to load any "user assemblies", due to now using AssemblyDefinitions. This means RPCs were sent as full name, which is wasteful (but not an error as such).
Changed: UpdateRpcList with LINQ. This is less code, easier maintain and read.
Changed: The "on compile" disconnect is done much faster now and hopefully avoids some issues.
Internal: Removed PhotonNetwork.photonMono. As the Handler is supposed to be a singleton with Instance, PUN should use that.
Fixed: Two layout issues in the PhotonView Inspector GUI (for very lean windows).
Added: Option to dispatch incoming messages, even if Time.timeScale = 0: PhotonNetwork.MinimalTimeScaleToDispatchInFixedUpdate. It defaults to not being used.
Changed: Execution order for disconnect on quit. As OnApplicationQuit is followed by OnDisable, PUN now disconnects in OnDisable, if OnApplicationQuit was called previously. This means that you can now send a final message in OnApplicationQuit. It's not guaranteed to arrive anywhere, as the message won't be repeated on loss.
Changed: WebRpcResponse.ReturnCode -> ResultCode and WebRpcResponse.DebugMessage -> Message.
Added: Now showing current best region and its ping from Players' Prefs in ServerSettings.
Added: ServerSettings now lets you edit Rpc List in Inspector, shows the rpc hash as Hex string and let ypu copy it in the OS Clipboard.
Fixed: Textures needed for editor interfaces now search for the PUN folder instead of assuming a hardcoded path.
Updated: To new library version v4.1.2.17.

v2.13 (25. June 2019)
Fixed: Typos and null checks in PhotonNetwork class.
Fixed: SerializationProtocol selection for WebGL.
Fixed: Missing IWebRpcCallback interface reference added to MonoBehaviourPunCallbacks.
Added: PhotonNetwork.AllocateViewID(bool sceneObject), which can be used to just get a viewID that is then assigned manually.
Updated: Improved wording for warning on missing photonViews during serialization.
Changed: The library now has a changes-realtime.txt file instead of a release_history.txt. The plan is to separate library and Realtime API updates from those of PUN and other packages. Also check out changes-realtime.txt and changes-library.txt.
Updated: PUN Cockpit. It will now rejoin instead of join if needed.
Updated: To new library version 4.1.2.16.
    This fixes an issue with a ThreadAbortException thrown on Android (with specific Unity build settings) and improves connection stability in cases where the ping goes up temporarily.
Chat
    Added: ChatClient.TryGetPrivateChannelByUser.

v2.12 (6. May 2019)
Fixed: Breaking change of EventData. The properties Sender and CustomData are back and they keys (in the event Parameters) can now be configured at runtime (if needed).
Updated: To new library version 4.1.2.14 (6. May 2019 - rev5088).

v2.11 (3. May 2019)
Fixed: EventData usage. PUN v2.10 had a bug in Ownership Transfer calls and some events.
Fixed: ClientState.ConnectedToMasterserver did not have the same value as ConnectedToMasterServer (and no longer got used at all). This affects only rare cases where the enum is directly used (PUN was updated).
Changed: Account registration scripts to use Unity's built-in JSON parsing. Now, PUN no longer incldues the NewtonSoft Json dll (which should avoid the occasional clash of dlls).
Updated: To new library version 4.1.2.13 (3. May 2019 - rev5086).
    Changed: EventData was changed in the Photon3Unity3d.dll again. Now it does not have a Sender or CustomData property anymore as those were not workign for Chat (and misleading). Instead, those are fetched from the Parameters of an event (each API provides accessor extensions).
    Added: PhotonPeer.ReuseEventInstance as option to use a single EventData instance for all incoming events. This reduces memory garbage. The drawback is: An event provided via OnEvent(EventData photonEvent) is invalidated right after the callback finished. That event's content will get modified. Typically this is not a problem as events are rarely cached.
Chat
    Fixed: Properly add local client's UserId to public channels' Subscribers list when applicable.


v2.10 (26. April 2019)
Fixed: Unity 2019 compatibility. Removed warnings about obsolete APIs. Code clean up to remove compiler warnings in Unity 2019.
Fixed: PhotonTransformView does not interpolate between the first streamed data and subsequent to avoid the initial drift between the player's original position and the current position.
Changed: GetGameList operation is not sent when filter is null or empty. This resulted in a server-side error and now GetGameList logs this case and returns false.
Changed: IsConnectedAndReady is now also false for ClientState.DisconnectingFromGameserver, DisconnectingFromMasterserver and DisconnectingFromNameServer.
Changed: InLobby property is now checking the State == JoinedLobby, which is analog to InRoom.
Changed: InRoom property getter checks if CurrentRoom is not null.
Added: Nintendo Switch Authentication enum value. More about this on our doc page for Nintendo Switch development.
Changed: removed references to PUN1's removed PhotonNetwork.GetRoomList().
Changed: Renamed ClientState items which ended on "Gameserver" and "Masterserver" to using PascalCase "GameServer" and "MasterServer". The previous names are obsolete to ease upgrading this, if needed.
Fixed: BroadcastPropsChangeToAll is applied correctly (it wasn't used properly, when false).
Fixed: When in offline mode, OpSetPropertiesOfActor does not get called (it failed due to not being connected).
Updated: To new library version 4.1.2.12 (26. April 2019 - rev5046).
Note: EventData.Parameters is no longer guaranteed to be non-null! Events sent via RaiseEvent (the most common form) will have Code, Sender and CustomData but Parameters will be null. Internally, this means we can re-use some more memory. PUN covers this change for you but if you use the events more directly, you may notice.
Chat
    Fixed: properly add local client's UserId to public channels' Subscribers list when applicable.

v2.9 (26. March 2019)
Fixed: Automatic level synchronization, which was affected by the callback change in v2.8.0. Now, as in 2.7 and earlier, the scene is loaded on join, before the OnJoinedRoom callback.
Changed: The api reference for LevelLoadingProgress and LoadLevel.
Fixed: Surplus call to Disconnect when the app quits but PUN is offline. This also means there is no OnDisconnected() callback in this case (which happened unintentionally).
Internal: SetLevelInPropsIfSynced() is now called in NewSceneLoaded() under the condition that PUN was not causing the scene-load. So it's not called when the scene loaded via PhotonNetwork.LoadScene.
Fixed: SetLevelInPropsIfSynced() now checks if the new value is not in the props yet and if so, it will set the property right away.
Fixed: When using LoadLevel(), this will set the new sceneId as property right away (unless it didn't change). This should avoid delays on other clients loading the same scene.
Changed: The condition when a async load is canceled. If at all, it only cancels a PUN-initiated loading, if the new sceneId does not refer to the scene in the properties.
Fixed: PunCockpit script. Using the left side of the lobby panel, it now uses the default lobby (no name, type = default) for CreateRoom and JoinRandom. If you JoinLobby in one client and CreateRoom in another, the created room will also show up in the list (bottom right).

v2.8.1 (21. March 2019)
Fixed: Problem with assembly definition and WebSockets usage.
Removed: Unused code (fixing the warning about that).
Note: This version has minimal changes that don't affect the gameplay, so we decided not to change the version in PUN (which would separate players) or in the Asset Store (which triggers a mail).
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/arvr/current/connection-and-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 callbacks OnRoomPropertiesUpdate and OnPlayerPropertiesUpdate are not called when/before entering a room. It was the case whenever properties change, which is also the case when the Realtime API constructs the room or the player (with properties). Wait for OnJoinedRoom and check properties the first time when that's called.
Updated: Photon3Unity3d.dll library to 4.1.2.10, 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 4.1.2.9, 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[0] 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.

v2.5 (20th November 2018)
Fixed: The RoomOption CleanupCacheOnLeave is now correctly set per room (if set for creation of the room). This bug caused a server-side cleanup of Instantiate-events, buffered RPCs and other buffered events, despite a different setting in the options. This messed with a game's state, if you wanted to keep networked objects when players leave.
Fixed: Regression during PhotoView cleanup leading to loss of viewId in OnDisable and OnDestroy calls. Now OnDisable and OnDestroy can access the viewID. Pooling the game object will set the new viewID before OnEnable is called.
Fixed: Asteroids Demo. The cached room list now gets cleared correctly when the client joins a room / leaves the lobby.
Added: The component "PhotonTransformViewClassic", which provides all the options (and implementation) from PUN Classic (1.xy). Use this if you want to use the options that were previously available. This component is deliberately not used by default.
Changed: The inspector for PhotonTransformView to hint about the PhotonTransformViewClassic and using your own synchronization in general.
Changed: PUN now suppresses the compiler warning "649" on newer versions of Unity for some of our Basics Tutorial scripts. This helps us keep the used code simple and better at "teaching" PUN.
Changed: The Realtime API no longer sends the actor properties on a rejoin. The values are known to the server and should not be updated. Set new values after rejoining the room, if that's needed.
Fixed: Support for 2018.3 and newer prefab workflow to not show/deal the viewId field when editing a prefab.
Fixed: ViewID assignment algorithm when reaching the max view ID value.
Fixed: Removed harmless "duplicate"-warnig inside the DemoHub context. Now eventSystem is only created if needed.

v2.4 (24th October 2018)
Fixed: Duplicated Instantiation Events when using PhotonNetwork.ReconnectAndRejoin: when a client rejoins a room, his server-side cached Instantiation Events get duplicated, resulting in duplicated objects. This has been fixed.
Changed: When Unity exports with Runtime 4.x and Mono, PUN and Chat now use a new, async socket class to work around issues with Socket.Receive blocking indefinitely (and timing out). This is now available for UDP and TCP. IL2CPP is not using this.
Note: We changed the "productname" internally from PhotonUnityNetworking to PUN2, to avoid a problem when building UWP apps with the AssemblyDefinitions in place. In that case, two .dbg files were created and put into the generated solution. This does not affect projects which import PUN (without the ProjectSettings file) but you should keep this in mind.
Updated: The Photon3Unity3d.dll to v4.1.2.4 with some fixes and improvements. See release_history.txt.

v2.3.1 (17th October 2018)
Updated: The Photon3Unity3d.dll to v4.1.2.3 for fix one issue with duplicates of fragmented messages. This could cause an exception and disconnect.

v2.3 (16th October 2018)
Fixed: The "Background Fallback Thread". PhotonHandler.Awake() now starts the fallback thread which send acks, even if the Main Loop is paused. This was missing and potentially causing timeouts when loading levels.
Changed: The Background Fallback Thread will keep a connection for another 30 seconds. This is set via ConnectionHandler.KeepAliveInBackground.
Moved: Instantiation will now call SendInstantiate() earlier to makes sure the event to instantiate is sent (queued) before anything related to the new PhotonViews. This fixes issues when calling an RPC right within Awake() of a new object.
Added: Check in Instantiate, if the prefab has a PhotonView. Logs error and returns null, if it doesn't have one.
Removed: Surplus warning logged when the lower-level connection reports a Disconnected state more than once.
Fixed: When using the 4.x mono runtime in Unity, the Socket.Receive method could get stuck and cause timeouts (in Editor and builds). The LoadBalancingClient now works around this by using the SocketUdpAsync class from our Photon dll in those cases. Please report if there are network-issues with 4.x runtime, mono.
Changed: Enum DisconnectCause. Replace TimeoutDisconnect with ClientTimeout. Replace DisconnectByServer with ServerTimeout. Replace DisconnectByServerUserLimit with MaxCcuReached.
Added: Enum DisconnectCause.DisconnectByServerReasonUnknown for the case it's neither a ccu-limit, timeout nor a disconnect by the room's logic.
Changed: Warning-dialog "AppId not set" is not shown, if the configuration points to a Master Server (Photon OnPremise). When the new server SDK expects an AppId, too, this could be reverted.
Updated: Cockpit demo scene to expose automaticallySyncLevel and load level form. Updated links to docs.
Updated: The readme.txt.
Updated: The Photon3Unity3d.dll to v4.1.2.2, which has a few changes. See release_history.txt.

v2.2  (27th September 2018)
Added: Assembly Definitions for Unity 2017.3 and up. PUN, Realtime, Chat, the WebSocket folder and some Editor classes are now assemblies and will recompile less frequently.
Added: Chat Demo. An updated version of the UI from PUN Classic.
Fixed: PunCockpit integration fixed, scene camera was not set properly. This fixes the black screen over any demo which uses the cockpit.
Fixed: OnCustomAuthenticationFailed() was not virtual in MonoBehaviourPunCallbacks. Now it is and you can override it.
Changed: Custom editor for PhotonServerSettings, which hides AppIdVoice and AppIdChat when the APIs are not present in a project.
Removed: PhotonNetwork.InstantiateInRoomOnly. If you need to instantiate game objects before getting into a room, assign a PhotonView and PhotonView.viewID, when you arrive in a room.

v2.1  (13th September 2018)
Fixed: PunTurnManager fully ported to the new PUN 2 API.
Fixed: SlotRacer Player Control was not setup properly when joining late.
Fixed: Room is now properly cleaned up when unwanted disconnection occurs.
Fixed: WebGL exports can also use the new serialization protocol v1.8. Clients no longer have to set this manually when mixing WebGL and other exports for cross platform games.
Fixed: Before calling OnPhotonSerializeView on observed scripts, each PhotonView checks the component's isActiveAndEnabled. This better matches previous logic, where inactive objects are not running.
Changed: Internals of PhotonNetwork.Instantiate and .Destroy. The process is streamlined and always uses a PrefabPool. The DefaultPool works as before: It loads Resources and actually Destroys them. A custom pool may actually reuse objects and doesn't have to load prefabs from Resources.
Added: DefaultPool class, which is a simple remake of the previous workflow with prefabs and resources.
Changed: The LevelPrefix is now a byte value. It was a short, even though PUN always just sent a byte. It's not changed otherwise and pending an overhault to become more usable.
Changed: AllocateViewId() and AllocateSceneViewId() now have a PhotonView as parameter. This allocates the viewId and applies it right away. Due to that, we no longer need a workaround for "allocated but not yet used" viewIds.
Removed: PhotonNetwork.ObjectPool value. Use PrefabPool to set a new pool.
Removed: UnAllocateViewID(). You no longer have to return any viewIDs, not even manually allocated ones.
Changed: SendInstantiate and ServerCleanInstantiateAndDestroy (called by an object's Destroy) now reuse their Hashtables for the events and the RaiseEventOptions. This reduces GC.
Changed: Internally, PUN stores which prefabs don't implement IPunInstantiateMagicCallback. This avoids calling GetComponents more than once in best case.
Changed: The Asteroids demo caches a list of available rooms now.

v2.0.1  (4th September 2018)
Updated: Asteroids Demo. Fixed room listing, player listing, the ready-button and the countdown for ship instantiation.
Added: A "teleport" setting to the PhotonRigidbody2DView and PhotonRigidbodyView. With this, you can implement teleporting as done in the Asteroids Demo.
Changed: When the PhotonServerSettings point to a Master Server, ConnectUsingSettings() will re-set the serialization protocol (SerializationProtocolType) to be compatible with the Photon Server SDK.

v2.0  (7th August 2018)
Updated: PUN! Cleaned up naming, callbacks, APIs and demos.
Note: We are redoing the docs online: https://doc.photonengine.com/en-us/pun/v2
