Skip to content

Releases: Unity-Technologies/com.unity.netcode.gameobjects

2.1.1

21 Oct 15:02
Compare
Choose a tag to compare

[2.1.1] - 2024-10-18

Added

  • Added ability to edit the NetworkConfig.AutoSpawnPlayerPrefabClientSide within the inspector view. (#3097)
  • Added IContactEventHandlerWithInfo that derives from IContactEventHandler that can be updated per frame to provide ContactEventHandlerInfo information to the RigidbodyContactEventManager when processing collisions. (#3094)
    • ContactEventHandlerInfo.ProvideNonRigidBodyContactEvents: When set to true, non-Rigidbody collisions with the registered Rigidbody will generate contact event notifications. (#3094)
    • ContactEventHandlerInfo.HasContactEventPriority: When set to true, the Rigidbody will be prioritized as the instance that generates the event if the Rigidbody colliding does not have priority. (#3094)
  • Added a static NetworkManager.OnInstantiated event notification to be able to track when a new NetworkManager instance has been instantiated. (#3088)
  • Added a static NetworkManager.OnDestroying event notification to be able to track when an existing NetworkManager instance is being destroyed. (#3088)

Fixed

  • Fixed issue where NetworkPrefabProcessor would not mark the prefab list as dirty and prevent saving the DefaultNetworkPrefabs asset when only imports or only deletes were detected.(#3103)
  • Fixed an issue where nested NetworkTransform components in owner authoritative mode cleared their initial settings on the server, causing improper synchronization. (#3099)
  • Fixed issue with service not getting synchronized with in-scene placed NetworkObject instances when a session owner starts a SceneEventType.Load event. (#3096)
  • Fixed issue with the in-scene network prefab instance update menu tool where it was not properly updating scenes when invoked on the root prefab instance. (#3092)
  • Fixed an issue where newly synchronizing clients would always receive current NetworkVariable values, potentially causing issues with collections if there were pending updates. Now, pending state updates serialize previous values to avoid duplicates on new clients. (#3081)
  • Fixed issue where changing ownership would mark every NetworkVariable dirty. Now, it will only mark any NetworkVariable with owner read permissions as dirty and will send/flush any pending updates to all clients prior to sending the change in ownership message. (#3081)
  • Fixed an issue where transferring ownership of NetworkVariable collections didn't update the new owner’s previous value, causing the last added value to be detected as a change during additions or removals. (#3081)
  • Fixed issue where a client (or server) with no write permissions for a NetworkVariable using a standard .NET collection type could still modify the collection which could cause various issues depending upon the modification and collection type. (#3081)
  • Fixed issue where applying the position and/or rotation to the NetworkManager.ConnectionApprovalResponse when connection approval and auto-spawn player prefab were enabled would not apply the position and/or rotation when the player prefab was instantiated. (#3078)
  • Fixed issue where NetworkObject.SpawnWithObservers was not being honored when spawning the player prefab. (#3077)
  • Fixed issue with the client count not being correct on the host or server side when a client disconnects itself from a session. (#3075)

Changed

  • Changed NetworkConfig.AutoSpawnPlayerPrefabClientSide is no longer automatically set when starting NetworkManager. (#3097)
  • Updated NetworkVariableDeltaMessage so the server now forwards delta state updates from clients immediately, instead of waiting until the end of the frame or the next network tick. (#3081)

2.0.0

17 Sep 15:38
Compare
Choose a tag to compare

[2.0.0] - 2024-09-12

Added

  • Added tooltips for all of the NetworkObject component's properties. (#3052)
  • Added message size validation to named and unnamed message sending functions for better error messages. (#3049)
  • Added "Check for NetworkObject Component" property to the Multiplayer->Netcode for GameObjects project settings. When disabled, this will bypass the in-editor NetworkObject check on NetworkBehaviour components. (#3031)
  • Added NetworkTransform.SwitchTransformSpaceWhenParented property that, when enabled, will handle the world to local, local to world, and local to local transform space transitions when interpolation is enabled. (#3013)
  • Added NetworkTransform.TickSyncChildren that, when enabled, will tick synchronize nested and/or child NetworkTransform components to eliminate any potential visual jittering that could occur if the NetworkTransform instances get into a state where their state updates are landing on different network ticks. (#3013)
  • Added NetworkObject.AllowOwnerToParent property to provide the ability to allow clients to parent owned objects when running in a client-server network topology. (#3013)
  • Added NetworkObject.SyncOwnerTransformWhenParented property to provide a way to disable applying the server's transform information in the parenting message on the client owner instance which can be useful for owner authoritative motion models. (#3013)
  • Added NetcodeEditorBase editor helper class to provide easier modification and extension of the SDK's components. (#3013)

Fixed

  • Fixed issue where NetworkAnimator would send updates to non-observer clients. (#3057)
  • Fixed issue where an exception could occur when receiving a universal RPC for a NetworkObject that has been despawned. (#3052)
  • Fixed issue where a NetworkObject hidden from a client that is then promoted to be session owner was not being synchronized with newly joining clients.(#3051)
  • Fixed issue where clients could have a wrong time delta on NetworkVariableBase which could prevent from sending delta state updates. (#3045)
  • Fixed issue where setting a prefab hash value during connection approval but not having a player prefab assigned could cause an exception when spawning a player. (#3042)
  • Fixed issue where the NetworkSpawnManager.HandleNetworkObjectShow could throw an exception if one of the NetworkObject components to show was destroyed during the same frame. (#3030)
  • Fixed issue where the NetworkManagerHelper was continuing to check for hierarchy changes when in play mode. (#3026)
  • Fixed issue with newly/late joined clients and NetworkTransform synchronization of parented NetworkObject instances. (#3013)
  • Fixed issue with smooth transitions between transform spaces when interpolation is enabled (requires NetworkTransform.SwitchTransformSpaceWhenParented to be enabled). (#3013)

Changed

  • Changed NetworkTransformEditor now uses NetworkTransform as the base type class to assure it doesn't display a foldout group when using the base NetworkTransform component class. (#3052)
  • Changed NetworkAnimator.Awake is now a protected virtual method. (#3052)
  • Changed when invoking NetworkManager.ConnectionManager.DisconnectClient during a distributed authority session a more appropriate message is logged. (#3052)
  • Changed NetworkTransformEditor so it now derives from NetcodeEditorBase. (#3013)
  • Changed NetworkRigidbodyBaseEditor so it now derives from NetcodeEditorBase. (#3013)
  • Changed NetworkManagerEditor so it now derives from NetcodeEditorBase. (#3013)

1.11.0

23 Aug 14:41
Compare
Choose a tag to compare

[1.11.0] - 2024-08-20

Added

  • Added NetworkVariable.CheckDirtyState that is to be used in tandem with collections in order to detect whether the collection or an item within the collection has changed. (#3005)

Fixed

  • Fixed issue by adding null checks in NetworkVariableBase.CanClientRead and NetworkVariableBase.CanClientWrite methods to ensure safe access to NetworkBehaviour. (#3011)
  • Fixed issue using collections within NetworkVariable where the collection would not detect changes to items or nested items. (#3005)
  • Fixed issue where List, Dictionary, and HashSet collections would not uniquely duplicate nested collections. (#3005)
  • Fixed Issue where a state with dual triggers, inbound and outbound, could cause a false layer to layer state transition message to be sent to non-authority NetworkAnimator instances and cause a warning message to be logged. (#2999)
  • Fixed issue where FixedStringSerializer<T> was using NetworkVariableSerialization<byte>.AreEqual to determine if two bytes were equal causes an exception to be thrown due to no byte serializer having been defined. (#2992)

Changed

  • Changed permissions exception thrown in NetworkList to exiting early with a logged error that is now a unified permissions message within NetworkVariableBase. (#3005)
  • Changed permissions exception thrown in NetworkVariable.Value to exiting early with a logged error that is now a unified permissions message within NetworkVariableBase. (#3005)

1.10.0

23 Aug 14:39
Compare
Choose a tag to compare

[1.10.0] - 2024-07-22

Added

  • Added NetworkBehaviour.OnNetworkPreSpawn and NetworkBehaviour.OnNetworkPostSpawn methods that provide the ability to handle pre and post spawning actions during the NetworkObject spawn sequence. (#2906)
  • Added a client-side only NetworkBehaviour.OnNetworkSessionSynchronized convenience method that is invoked on all NetworkBehaviours after a newly joined client has finished synchronizing with the network session in progress. (#2906)
  • Added NetworkBehaviour.OnInSceneObjectsSpawned convenience method that is invoked when all in-scene NetworkObjects have been spawned after a scene has been loaded or upon a host or server starting. (#2906)

Fixed

  • Fixed issue where the realtime network stats monitor was not able to display RPC traffic in release builds due to those stats being only available in development builds or the editor. (#2980)
  • Fixed issue where NetworkManager.ScenesLoaded was not being updated if PostSynchronizationSceneUnloading was set and any loaded scenes not used during synchronization were unloaded.(#2977)
  • Fixed issue where internal delta serialization could not have a byte serializer defined when serializing deltas for other types. Added [GenerateSerializationForType(typeof(byte))] to both the NetworkVariable and AnticipatedNetworkVariable classes to assure a byte serializer is defined. (#2953)
  • Fixed issue with the client count not being correct on the host or server side when a client disconnects itself from a session. (#2941)
  • Fixed issue with the host trying to send itself a message that it has connected when first starting up. (#2941)
  • Fixed issue where in-scene placed NetworkObjects could be destroyed if a client disconnects early and/or before approval. (#2923)
  • Fixed issue where NetworkDeltaPosition would "jitter" periodically if both unreliable delta state updates and half-floats were used together. (#2922)
  • Fixed issue where NetworkRigidbody2D would not properly change body type based on the instance's authority when spawned. (#2916)
  • Fixed issue where a NetworkObject component's associated NetworkBehaviour components would not be detected if scene loading is disabled in the editor and the currently loaded scene has in-scene placed NetworkObjects. (#2906)
  • Fixed issue where an in-scene placed NetworkObject with NetworkTransform that is also parented under a GameObject would not properly synchronize when the parent GameObject had a world space position other than 0,0,0. (#2895)

1.9.1

25 Apr 22:40
7d27c51
Compare
Choose a tag to compare

[1.9.1] - 2024-04-18

Added

  • Added AnticipatedNetworkVariable, which adds support for client anticipation of NetworkVariable values, allowing for more responsive gameplay (#2820)
  • Added AnticipatedNetworkTransform, which adds support for client anticipation of NetworkTransforms (#2820)
  • Added NetworkVariableBase.ExceedsDirtinessThreshold to allow network variables to throttle updates by only sending updates when the difference between the current and previous values exceeds a threshold. (This is exposed in NetworkVariable with the callback NetworkVariable.CheckExceedsDirtinessThreshold) (#2820)
  • Added NetworkVariableUpdateTraits, which add additional throttling support: MinSecondsBetweenUpdates will prevent the NetworkVariable from sending updates more often than the specified time period (even if it exceeds the dirtiness threshold), while MaxSecondsBetweenUpdates will force a dirty NetworkVariable to send an update after the specified time period even if it has not yet exceeded the dirtiness threshold. (#2820)
  • Added virtual method NetworkVariableBase.OnInitialize() which can be used by NetworkVariable subclasses to add initialization code (#2820)
  • Added virtual method NetworkVariableBase.Update(), which is called once per frame to support behaviors such as interpolation between an anticipated value and an authoritative one. (#2820)
  • Added NetworkTime.TickWithPartial, which represents the current tick as a double that includes the fractional/partial tick value. (#2820)
  • NetworkVariable now includes built-in support for NativeHashSet, NativeHashMap, List, HashSet, and Dictionary (#2813)
  • NetworkVariable now includes delta compression for collection values (NativeList, NativeArray, NativeHashSet, NativeHashMap, List, HashSet, Dictionary, and FixedString types) to save bandwidth by only sending the values that changed. (Note: For NativeList, NativeArray, and List, this algorithm works differently than that used in NetworkList. This algorithm will use less bandwidth for "set" and "add" operations, but NetworkList is more bandwidth-efficient if you are performing frequent "insert" operations.) (#2813)
  • UserNetworkVariableSerialization now has optional callbacks for WriteDelta and ReadDelta. If both are provided, they will be used for all serialization operations on NetworkVariables of that type except for the first one for each client. If either is missing, the existing Write and Read will always be used. (#2813)
  • Network variables wrapping INetworkSerializable types can perform delta serialization by setting UserNetworkVariableSerialization<T>.WriteDelta and UserNetworkVariableSerialization<T>.ReadDelta for those types. The built-in INetworkSerializable serializer will continue to be used for all other serialization operations, but if those callbacks are set, it will call into them on all but the initial serialization to perform delta serialization. (This could be useful if you have a large struct where most values do not change regularly and you want to send only the fields that did change.) (#2813)

Fixed

  • Fixed issue where NetworkTransformEditor would throw and exception if you excluded the physics package. (#2871)
  • Fixed issue where NetworkTransform could not properly synchronize its base position when using half float precision. (#2845)
  • Fixed issue where the host was not invoking OnClientDisconnectCallback for its own local client when internally shutting down. (#2822)
  • Fixed issue where NetworkTransform could potentially attempt to "unregister" a named message prior to it being registered. (#2807)
  • Fixed issue where in-scene placed NetworkObjects with complex nested children NetworkObjects (more than one child in depth) would not synchronize properly if WorldPositionStays was set to true. (#2796)

Changed

  • Changed NetworkObjectReference and NetworkBehaviourReference to allow null references when constructing and serializing. (#2874)
  • Changed NetworkAnimator no longer requires the Animator component to exist on the same GameObject. (#2872)
  • Changed NetworkTransform to now use NetworkTransformMessage as opposed to named messages for NetworkTransformState updates. (#2810)
  • Changed CustomMessageManager so it no longer attempts to register or "unregister" a null or empty string and will log an error if this condition occurs. (#2807)

1.8.1

21 Feb 16:23
eb21383
Compare
Choose a tag to compare

Fixed

  • Fixed a compile error when compiling for IL2CPP targets when using the new [Rpc] attribute. (#2824)

1.8.0

29 Jan 16:52
53b735c
Compare
Choose a tag to compare

Added

  • Added a new RPC attribute, which is simply Rpc. (#2762)
    • This is a generic attribute that can perform the functions of both Server and Client RPCs, as well as enabling client-to-client RPCs. Includes several default targets: Server, NotServer, Owner, NotOwner, Me, NotMe, ClientsAndHost, and Everyone. Runtime overrides are available for any of these targets, as well as for sending to a specific ID or groups of IDs.
    • This attribute also includes the ability to defer RPCs that are sent to the local process to the start of the next frame instead of executing them immediately, treating them as if they had gone across the network. The default behavior is to execute immediately.
    • This attribute effectively replaces ServerRpc and ClientRpc. ServerRpc and ClientRpc remain in their existing forms for backward compatibility, but Rpc will be the recommended and most supported option.
  • Added NetworkManager.OnConnectionEvent as a unified connection event callback to notify clients and servers of all client connections and disconnections within the session (#2762)
  • Added NetworkManager.ServerIsHost and NetworkBehaviour.ServerIsHost to allow a client to tell if it is connected to a host or to a dedicated server (#2762)
  • Added SceneEventProgress.SceneManagementNotEnabled return status to be returned when a NetworkSceneManager method is invoked and scene management is not enabled. (#2735)
  • Added SceneEventProgress.ServerOnlyAction return status to be returned when a NetworkSceneManager method is invoked by a client. (#2735)
  • Added NetworkObject.InstantiateAndSpawn and NetworkSpawnManager.InstantiateAndSpawn methods to simplify prefab spawning by assuring that the prefab is valid and applies any override prior to instantiating the GameObject and spawning the NetworkObject instance. (#2710)

Fixed

  • Fixed issue where a client disconnected by a server-host would not receive a local notification. (#2789)
  • Fixed issue where a server-host could shutdown during a relay connection but periodically the transport disconnect message sent to any connected clients could be dropped. (#2789)
  • Fixed issue where a host could disconnect its local client but remain running as a server. (#2789)
  • Fixed issue where OnClientDisconnectedCallback was not being invoked under certain conditions. (#2789)
  • Fixed issue where OnClientDisconnectedCallback was always returning 0 as the client identifier. (#2789)
  • Fixed issue where if a host or server shutdown while a client owned NetworkObjects (other than the player) it would throw an exception. (#2789)
  • Fixed issue where setting values on a NetworkVariable or NetworkList within OnNetworkDespawn during a shutdown sequence would throw an exception. (#2789)
  • Fixed issue where a teleport state could potentially be overridden by a previous unreliable delta state. (#2777)
  • Fixed issue where NetworkTransform was using the NetworkManager.ServerTime.Tick as opposed to NetworkManager.NetworkTickSystem.ServerTime.Tick during the authoritative side's tick update where it performed a delta state check. (#2777)
  • Fixed issue where a parented in-scene placed NetworkObject would be destroyed upon a client or server exiting a network session but not unloading the original scene in which the NetworkObject was placed. (#2737)
  • Fixed issue where during client synchronization and scene loading, when client synchronization or the scene loading mode are set to LoadSceneMode.Single, a CreateObjectMessage could be received, processed, and the resultant spawned NetworkObject could be instantiated in the client's currently active scene that could, towards the end of the client synchronization or loading process, be unloaded and cause the newly created NetworkObject to be destroyed (and throw and exception). (#2735)
  • Fixed issue where a NetworkTransform instance with interpolation enabled would result in wide visual motion gaps (stuttering) under above normal latency conditions and a 1-5% or higher packet are drop rate. (#2713)
  • Fixed issue where you could not have multiple source network prefab overrides targeting the same network prefab as their override. (#2710)

Changed

  • Changed the server or host shutdown so it will now perform a "soft shutdown" when NetworkManager.Shutdown is invoked. This will send a disconnect notification to all connected clients and the server-host will wait for all connected clients to disconnect or timeout after a 5 second period before completing the shutdown process. (#2789)
  • Changed OnClientDisconnectedCallback will now return the assigned client identifier on the local client side if the client was approved and assigned one prior to being disconnected. (#2789)
  • Changed NetworkTransform.SetState (and related methods) now are cumulative during a fractional tick period and sent on the next pending tick. (#2777)
  • NetworkManager.ConnectedClientsIds is now accessible on the client side and will contain the list of all clients in the session, including the host client if the server is operating in host mode (#2762)
  • Changed NetworkSceneManager to return a SceneEventProgress status and not throw exceptions for methods invoked when scene management is disabled and when a client attempts to access a NetworkSceneManager method by a client. (#2735)
  • Changed NetworkTransform authoritative instance tick registration so a single NetworkTransform specific tick event update will update all authoritative instances to improve perofmance. (#2713)
  • Changed NetworkPrefabs.OverrideToNetworkPrefab dictionary is no longer used/populated due to it ending up being related to a regression bug and not allowing more than one override to be assigned to a network prefab asset. (#2710)
  • Changed in-scene placed NetworkObjects now store their source network prefab asset's GlobalObjectIdHash internally that is used, when scene management is disabled, by clients to spawn the correct prefab even if the NetworkPrefab entry has an override. This does not impact dynamically spawning the same prefab which will yield the override on both host and client. (#2710)
  • Changed in-scene placed NetworkObjects no longer require a NetworkPrefab entry with GlobalObjectIdHash override in order for clients to properly synchronize. (#2710)
  • Changed in-scene placed NetworkObjects now set their IsSceneObject value when generating their GlobalObjectIdHash value. (#2710)
  • Changed the default NetworkConfig.SpawnTimeout value from 1.0s to 10.0s. (#2710)

1.7.1

24 Nov 16:01
5df824c
Compare
Choose a tag to compare

[1.7.1] - 2023-11-24

Fixed

  • Fixed a bug where having a class with Rpcs that inherits from a class without Rpcs that inherits from NetworkVariable would cause a compile error. (#2751)
  • Fixed issue where NetworkBehaviour.Synchronize was not truncating the write buffer if nothing was serialized during NetworkBehaviour.OnSynchronize causing an additional 6 bytes to be written per NetworkBehaviour component instance. (#2749)

1.7.0

26 Oct 16:47
f4004c7
Compare
Choose a tag to compare

[1.7.0] - 2023-10-11

Added

  • exposed NetworkObject.GetNetworkBehaviourAtOrderIndex as a public API (#2724)
  • Added context menu tool that provides users with the ability to quickly update the GlobalObjectIdHash value for all in-scene placed prefab instances that were created prior to adding a NetworkObject component to it. (#2707)
  • Added methods NetworkManager.SetPeerMTU and NetworkManager.GetPeerMTU to be able to set MTU sizes per-peer (#2676)
  • Added GenerateSerializationForGenericParameterAttribute, which can be applied to user-created Network Variable types to ensure the codegen generates serialization for the generic types they wrap. (#2694)
  • Added GenerateSerializationForTypeAttribute, which can be applied to any class or method to ensure the codegen generates serialization for the specific provided type. (#2694)
  • Exposed NetworkVariableSerialization<T>.Read, NetworkVariableSerialization<T>.Write, NetworkVariableSerialization<T>.AreEqual, and NetworkVariableSerialization<T>.Duplicate to further support the creation of user-created network variables by allowing users to access the generated serialization methods and serialize generic types efficiently without boxing. (#2694)
  • Added NetworkVariableBase.MarkNetworkBehaviourDirty so that user-created network variable types can mark their containing NetworkBehaviour to be processed by the update loop. (#2694)

Fixed

  • Fixed issue where the server side NetworkSceneManager instance was not adding the currently active scene to its list of scenes loaded. (#2723)
  • Generic NetworkBehaviour types no longer result in compile errors or runtime errors (#2720)
  • Rpcs within Generic NetworkBehaviour types can now serialize parameters of the class's generic types (but may not have generic types of their own) (#2720)
  • Errors are no longer thrown when entering play mode with domain reload disabled (#2720)
  • NetworkSpawn is now correctly called each time when entering play mode with scene reload disabled (#2720)
  • NetworkVariables of non-integer types will no longer break the inspector (#2714)
  • NetworkVariables with NonSerializedAttribute will not appear in the inspector (#2714)
  • Fixed issue where UnityTransport would attempt to establish WebSocket connections even if using UDP/DTLS Relay allocations when the build target was WebGL. This only applied to working in the editor since UDP/DTLS can't work in the browser. (#2695)
  • Fixed issue where a NetworkBehaviour component's OnNetworkDespawn was not being invoked on the host-server side for an in-scene placed NetworkObject when a scene was unloaded (during a scene transition) and the NetworkBehaviour component was positioned/ordered before the NetworkObject component. (#2685)
  • Fixed issue where SpawnWithObservers was not being honored when NetworkConfig.EnableSceneManagement was disabled. (#2682)
  • Fixed issue where NetworkAnimator was not internally tracking changes to layer weights which prevented proper layer weight synchronization back to the original layer weight value. (#2674)
  • Fixed "writing past the end of the buffer" error when calling ResetDirty() on managed network variables that are larger than 256 bytes when serialized. (#2670)
  • Fixed issue where generation of the DefaultNetworkPrefabs asset was not enabled by default. (#2662)
  • Fixed issue where the GlobalObjectIdHash value could be updated but the asset not marked as dirty. (#2662)
  • Fixed issue where the GlobalObjectIdHash value of a (network) prefab asset could be assigned an incorrect value when editing the prefab in a temporary scene. (#2662)
  • Fixed issue where the GlobalObjectIdHash value generated after creating a (network) prefab from an object constructed within the scene would not be the correct final value in a stand alone build. (#2662)

Changed

  • Updated dependency on com.unity.transport to version 1.4.0. (#2716)

1.6.0

29 Aug 21:53
4ee8da0
Compare
Choose a tag to compare

[1.6.0] - 2023-08-29

Added

  • Added a protected virtual method NetworkTransform.OnInitialize(ref NetworkTransformState replicatedState) that just returns the replicated state reference.

Fixed

  • Fixed issue where invoking NetworkManager.Shutdown within NetworkManager.OnClientStopped or NetworkManager.OnServerStopped would force NetworkManager.ShutdownInProgress to remain true after completing the shutdown process. (#2661)
  • Issue where ARMv7 Android builds would crash when trying to validate the batch header. (#2654)
  • Fixed issue with client synchronization of position when using half precision and the delta position reaches the maximum value and is collapsed on the host prior to being forwarded to the non-owner clients. (#2636)
  • Fixed issue with scale not synchronizing properly depending upon the spawn order of NetworkObjects. (#2636)
  • Fixed issue position was not properly transitioning between ownership changes with an owner authoritative NetworkTransform. (#2636)
  • Fixed issue where a late joining non-owner client could update an owner authoritative NetworkTransform if ownership changed without any updates to position prior to the non-owner client joining. (#2636)