Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com).

## [2.0.0-pre.1] - 2024-06-17

### Added

- Added event `NetworkManager.OnSessionOwnerPromoted` that is invoked when a new session owner promotion occurs. (#2948)
- Added `NetworkRigidBodyBase.GetLinearVelocity` and `NetworkRigidBodyBase.SetLinearVelocity` convenience/helper methods. (#2948)
- Added `NetworkRigidBodyBase.GetAngularVelocity` and `NetworkRigidBodyBase.SetAngularVelocity` convenience/helper methods. (#2948)

### Fixed

- Fixed issue when `NetworkTransform` half float precision is enabled and ownership changes the current base position was not being synchronized. (#2948)
- Fixed issue where `OnClientConnected` not being invoked on the session owner when connecting to a new distributed authority session. (#2948)
- Fixed issue where Rigidbody micro-motion (i.e. relatively small velocities) would result in non-authority instances slightly stuttering as the body would come to a rest (i.e. no motion). Now, the threshold value can increase at higher velocities and can decrease slightly below the provided threshold to account for this. (#2948)

### Changed

- Changed the client's owned objects is now returned (`NetworkClient` and `NetworkSpawnManager`) as an array as opposed to a list for performance purposes. (#2948)
- Changed `NetworkTransfrom.TryCommitTransformToServer` to be internal as it will be removed by the final 2.0.0 release. (#2948)
- Changed `NetworkTransformEditor.OnEnable` to a virtual method to be able to customize a `NetworkTransform` derived class by creating a derived editor control from `NetworkTransformEditor`. (#2948)
  • Loading branch information
Unity Technologies committed Jun 17, 2024
1 parent 36d539e commit ed38a4d
Show file tree
Hide file tree
Showing 47 changed files with 2,756 additions and 2,246 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,40 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com).

## [2.0.0-pre.1] - 2024-06-17

### Added

- Added event `NetworkManager.OnSessionOwnerPromoted` that is invoked when a new session owner promotion occurs. (#2948)
- Added `NetworkRigidBodyBase.GetLinearVelocity` and `NetworkRigidBodyBase.SetLinearVelocity` convenience/helper methods. (#2948)
- Added `NetworkRigidBodyBase.GetAngularVelocity` and `NetworkRigidBodyBase.SetAngularVelocity` convenience/helper methods. (#2948)

### Fixed

- Fixed issue when `NetworkTransform` half float precision is enabled and ownership changes the current base position was not being synchronized. (#2948)
- Fixed issue where `OnClientConnected` not being invoked on the session owner when connecting to a new distributed authority session. (#2948)
- Fixed issue where Rigidbody micro-motion (i.e. relatively small velocities) would result in non-authority instances slightly stuttering as the body would come to a rest (i.e. no motion). Now, the threshold value can increase at higher velocities and can decrease slightly below the provided threshold to account for this. (#2948)

### Changed

- Changed the client's owned objects is now returned (`NetworkClient` and `NetworkSpawnManager`) as an array as opposed to a list for performance purposes. (#2948)
- Changed `NetworkTransfrom.TryCommitTransformToServer` to be internal as it will be removed by the final 2.0.0 release. (#2948)
- Changed `NetworkTransformEditor.OnEnable` to a virtual method to be able to customize a `NetworkTransform` derived class by creating a derived editor control from `NetworkTransformEditor`. (#2948)


## [2.0.0-exp.5] - 2024-06-03

### Added


### Fixed

- Fixed issue where SessionOwner message was being treated as a new entry for the new message indexing when it should have been ordinally sorted with the legacy message indices. (#2942)

### Changed
- Changed `FastBufferReader` and `FastBufferWriter` so that they always ensure the length of items serialized is always serialized as an `uint` and added a check before casting for safe reading and writing.(#2946)


## [2.0.0-exp.4] - 2024-05-31

### Added
Expand Down
8 changes: 0 additions & 8 deletions Components.meta

This file was deleted.

58 changes: 29 additions & 29 deletions Editor/CodeGen/NetworkBehaviourILPP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ private bool ImportReferences(ModuleDefinition moduleDefinition, string[] assemb
continue;
}

if (networkVariableSerializationTypesTypeDef == null && netcodeTypeDef.Name == nameof(NetworkVariableSerializationTypes))
if (networkVariableSerializationTypesTypeDef == null && netcodeTypeDef.Name == nameof(NetworkVariableSerializationTypedInitializers))
{
networkVariableSerializationTypesTypeDef = netcodeTypeDef;
continue;
Expand Down Expand Up @@ -1007,103 +1007,103 @@ private bool ImportReferences(ModuleDefinition moduleDefinition, string[] assemb

switch (method.Name)
{
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_UnmanagedByMemcpy):
m_NetworkVariableSerializationTypes_InitializeSerializer_UnmanagedByMemcpy_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpyArray):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_UnmanagedByMemcpyArray):
m_NetworkVariableSerializationTypes_InitializeSerializer_UnmanagedByMemcpyArray_MethodRef = method;
break;

#if UNITY_NETCODE_NATIVE_COLLECTION_SUPPORT
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpyList):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_UnmanagedByMemcpyList):
m_NetworkVariableSerializationTypes_InitializeSerializer_UnmanagedByMemcpyList_MethodRef = method;
break;
#endif
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializable):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_UnmanagedINetworkSerializable):
m_NetworkVariableSerializationTypes_InitializeSerializer_UnmanagedINetworkSerializable_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializableArray):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_UnmanagedINetworkSerializableArray):
m_NetworkVariableSerializationTypes_InitializeSerializer_UnmanagedINetworkSerializableArray_MethodRef = method;
break;

#if UNITY_NETCODE_NATIVE_COLLECTION_SUPPORT
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializableList):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_UnmanagedINetworkSerializableList):
m_NetworkVariableSerializationTypes_InitializeSerializer_UnmanagedINetworkSerializableList_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_NativeHashSet):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_NativeHashSet):
m_NetworkVariableSerializationTypes_InitializeSerializer_NativeHashSet_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_NativeHashMap):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_NativeHashMap):
m_NetworkVariableSerializationTypes_InitializeSerializer_NativeHashMap_MethodRef = method;
break;
#endif
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_List):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_List):
m_NetworkVariableSerializationTypes_InitializeSerializer_List_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_HashSet):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_HashSet):
m_NetworkVariableSerializationTypes_InitializeSerializer_HashSet_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_Dictionary):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_Dictionary):
m_NetworkVariableSerializationTypes_InitializeSerializer_Dictionary_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_ManagedINetworkSerializable):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_ManagedINetworkSerializable):
m_NetworkVariableSerializationTypes_InitializeSerializer_ManagedINetworkSerializable_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_FixedString):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_FixedString):
m_NetworkVariableSerializationTypes_InitializeSerializer_FixedString_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_FixedStringArray):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_FixedStringArray):
m_NetworkVariableSerializationTypes_InitializeSerializer_FixedStringArray_MethodRef = method;
break;

#if UNITY_NETCODE_NATIVE_COLLECTION_SUPPORT
case nameof(NetworkVariableSerializationTypes.InitializeSerializer_FixedStringList):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeSerializer_FixedStringList):
m_NetworkVariableSerializationTypes_InitializeSerializer_FixedStringList_MethodRef = method;
break;
#endif

case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_ManagedIEquatable):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_ManagedIEquatable):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_ManagedIEquatable_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_UnmanagedIEquatable):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_UnmanagedIEquatable_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatableArray):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_UnmanagedIEquatableArray):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_UnmanagedIEquatableArray_MethodRef = method;
break;

#if UNITY_NETCODE_NATIVE_COLLECTION_SUPPORT
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatableList):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_UnmanagedIEquatableList):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_UnmanagedIEquatableList_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_NativeHashSet):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_NativeHashSet):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_NativeHashSet_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_NativeHashMap):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_NativeHashMap):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_NativeHashMap_MethodRef = method;
break;
#endif
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_List):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_List):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_List_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_HashSet):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_HashSet):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_HashSet_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_Dictionary):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_Dictionary):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_Dictionary_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_UnmanagedValueEquals):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_UnmanagedValueEquals_MethodRef = method;
break;
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEqualsArray):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_UnmanagedValueEqualsArray):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_UnmanagedValueEqualsArray_MethodRef = method;
break;
#if UNITY_NETCODE_NATIVE_COLLECTION_SUPPORT
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEqualsList):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_UnmanagedValueEqualsList):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_UnmanagedValueEqualsList_MethodRef = method;
break;
#endif
case nameof(NetworkVariableSerializationTypes.InitializeEqualityChecker_ManagedClassEquals):
case nameof(NetworkVariableSerializationTypedInitializers.InitializeEqualityChecker_ManagedClassEquals):
m_NetworkVariableSerializationTypes_InitializeEqualityChecker_ManagedClassEquals_MethodRef = method;
break;
}
Expand Down
37 changes: 24 additions & 13 deletions Editor/NetworkManagerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class NetworkManagerEditor : UnityEditor.Editor
private SerializedProperty m_ProtocolVersionProperty;
private SerializedProperty m_NetworkTransportProperty;
private SerializedProperty m_TickRateProperty;
#if MULTIPLAYER_SDK_INSTALLED
#if MULTIPLAYER_SERVICES_SDK_INSTALLED
private SerializedProperty m_NetworkTopologyProperty;
#endif
private SerializedProperty m_ClientConnectionBufferTimeoutProperty;
Expand Down Expand Up @@ -102,7 +102,7 @@ private void Initialize()
m_ProtocolVersionProperty = m_NetworkConfigProperty.FindPropertyRelative("ProtocolVersion");
m_NetworkTransportProperty = m_NetworkConfigProperty.FindPropertyRelative("NetworkTransport");
m_TickRateProperty = m_NetworkConfigProperty.FindPropertyRelative("TickRate");
#if MULTIPLAYER_SDK_INSTALLED
#if MULTIPLAYER_SERVICES_SDK_INSTALLED
m_NetworkTopologyProperty = m_NetworkConfigProperty.FindPropertyRelative("NetworkTopology");
#endif
m_ClientConnectionBufferTimeoutProperty = m_NetworkConfigProperty.FindPropertyRelative("ClientConnectionBufferTimeout");
Expand Down Expand Up @@ -142,7 +142,7 @@ private void CheckNullProperties()
m_ProtocolVersionProperty = m_NetworkConfigProperty.FindPropertyRelative("ProtocolVersion");
m_NetworkTransportProperty = m_NetworkConfigProperty.FindPropertyRelative("NetworkTransport");
m_TickRateProperty = m_NetworkConfigProperty.FindPropertyRelative("TickRate");
#if MULTIPLAYER_SDK_INSTALLED
#if MULTIPLAYER_SERVICES_SDK_INSTALLED
m_NetworkTopologyProperty = m_NetworkConfigProperty.FindPropertyRelative("NetworkTopology");
#endif
m_ClientConnectionBufferTimeoutProperty = m_NetworkConfigProperty.FindPropertyRelative("ClientConnectionBufferTimeout");
Expand Down Expand Up @@ -186,7 +186,7 @@ public override void OnInspectorGUI()

EditorGUILayout.Space();
EditorGUILayout.LabelField("Network Settings", EditorStyles.boldLabel);
#if MULTIPLAYER_SDK_INSTALLED
#if MULTIPLAYER_SERVICES_SDK_INSTALLED
EditorGUILayout.PropertyField(m_NetworkTopologyProperty);
#endif
EditorGUILayout.PropertyField(m_ProtocolVersionProperty);
Expand Down Expand Up @@ -310,21 +310,32 @@ public override void OnInspectorGUI()
GUI.enabled = false;
}

if (GUILayout.Button(new GUIContent("Start Host", "Starts a host instance" + buttonDisabledReasonSuffix)))
if (m_NetworkManager.NetworkConfig.NetworkTopology == NetworkTopologyTypes.ClientServer)
{
m_NetworkManager.StartHost();
}
if (GUILayout.Button(new GUIContent("Start Host", "Starts a host instance" + buttonDisabledReasonSuffix)))
{
m_NetworkManager.StartHost();
}

if (GUILayout.Button(new GUIContent("Start Server", "Starts a server instance" + buttonDisabledReasonSuffix)))
{
m_NetworkManager.StartServer();
}
if (GUILayout.Button(new GUIContent("Start Server", "Starts a server instance" + buttonDisabledReasonSuffix)))
{
m_NetworkManager.StartServer();
}

if (GUILayout.Button(new GUIContent("Start Client", "Starts a client instance" + buttonDisabledReasonSuffix)))
if (GUILayout.Button(new GUIContent("Start Client", "Starts a client instance" + buttonDisabledReasonSuffix)))
{
m_NetworkManager.StartClient();
}
}
else
{
m_NetworkManager.StartClient();
if (GUILayout.Button(new GUIContent("Start Client", "Starts a distributed authority client instance" + buttonDisabledReasonSuffix)))
{
m_NetworkManager.StartClient();
}
}


if (!EditorApplication.isPlaying)
{
GUI.enabled = true;
Expand Down
4 changes: 2 additions & 2 deletions Editor/NetworkObjectEditor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
#if MULTIPLAYER_SDK_INSTALLED
#if BYPASS_DEFAULT_ENUM_DRAWER && MULTIPLAYER_SERVICES_SDK_INSTALLED
using System.Linq;
#endif
using UnityEditor;
Expand Down Expand Up @@ -148,7 +148,7 @@ private void OnDestroy()

// Keeping this here just in case, but it appears that in Unity 6 the visual bugs with
// enum flags is resolved
#if BYPASS_DEFAULT_ENUM_DRAWER && MULTIPLAYER_SDK_INSTALLED
#if BYPASS_DEFAULT_ENUM_DRAWER && MULTIPLAYER_SERVICES_SDK_INSTALLED
[CustomPropertyDrawer(typeof(NetworkObject.OwnershipStatus))]
public class NetworkObjectOwnership : PropertyDrawer
{
Expand Down
Loading

0 comments on commit ed38a4d

Please sign in to comment.