From 3774bd24952b2b092d877fc9142dd55847e8ebce Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Fri, 11 Oct 2024 09:19:42 -0500 Subject: [PATCH 1/5] style Spelling fix for error message --- com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs index 9cd176c39b..d1582c6f03 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs @@ -336,7 +336,7 @@ public void DeferDespawn(int tickOffset, bool destroy = true) if (!HasAuthority) { - NetworkLog.LogError($"Only the authoirty can invoke {nameof(DeferDespawn)} and local Client-{NetworkManager.LocalClientId} is not the authority of {name}!"); + NetworkLog.LogError($"Only the authority can invoke {nameof(DeferDespawn)} and local Client-{NetworkManager.LocalClientId} is not the authority of {name}!"); return; } From 4688c7794040cbe17c7c0483ae008b86cb95a40f Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Fri, 11 Oct 2024 09:22:35 -0500 Subject: [PATCH 2/5] update Expose auto spawn player prefab within the inspector view when multiplayer SDK is installed. Remove the automatic enabling of this property if distributed authority is set. --- .../Editor/NetworkManagerEditor.cs | 7 +++++++ .../Runtime/Core/NetworkManager.cs | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index b93e7d90d5..2fc833dc69 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -31,6 +31,7 @@ public class NetworkManagerEditor : NetcodeEditorBase private SerializedProperty m_NetworkTransportProperty; private SerializedProperty m_TickRateProperty; #if MULTIPLAYER_SERVICES_SDK_INSTALLED + private SerializedProperty m_AutoSpawnPlayerPrefabClientSide; private SerializedProperty m_NetworkTopologyProperty; #endif private SerializedProperty m_ClientConnectionBufferTimeoutProperty; @@ -110,6 +111,7 @@ private void Initialize() m_TickRateProperty = m_NetworkConfigProperty.FindPropertyRelative("TickRate"); #if MULTIPLAYER_SERVICES_SDK_INSTALLED m_NetworkTopologyProperty = m_NetworkConfigProperty.FindPropertyRelative("NetworkTopology"); + m_AutoSpawnPlayerPrefabClientSide = m_NetworkConfigProperty.FindPropertyRelative("AutoSpawnPlayerPrefabClientSide"); #endif m_ClientConnectionBufferTimeoutProperty = m_NetworkConfigProperty.FindPropertyRelative("ClientConnectionBufferTimeout"); m_ConnectionApprovalProperty = m_NetworkConfigProperty.FindPropertyRelative("ConnectionApproval"); @@ -153,6 +155,7 @@ private void CheckNullProperties() m_TickRateProperty = m_NetworkConfigProperty.FindPropertyRelative("TickRate"); #if MULTIPLAYER_SERVICES_SDK_INSTALLED m_NetworkTopologyProperty = m_NetworkConfigProperty.FindPropertyRelative("NetworkTopology"); + m_AutoSpawnPlayerPrefabClientSide = m_NetworkConfigProperty.FindPropertyRelative("AutoSpawnPlayerPrefabClientSide"); #endif m_ClientConnectionBufferTimeoutProperty = m_NetworkConfigProperty.FindPropertyRelative("ClientConnectionBufferTimeout"); m_ConnectionApprovalProperty = m_NetworkConfigProperty.FindPropertyRelative("ConnectionApproval"); @@ -245,6 +248,10 @@ private void DisplayNetworkManagerProperties() EditorGUILayout.LabelField("Prefab Settings", EditorStyles.boldLabel); EditorGUILayout.PropertyField(m_ForceSamePrefabsProperty); EditorGUILayout.PropertyField(m_PlayerPrefabProperty, new GUIContent("Default Player Prefab")); +#if MULTIPLAYER_SERVICES_SDK_INSTALLED + EditorGUILayout.PropertyField(m_AutoSpawnPlayerPrefabClientSide, new GUIContent("Auto Spawn Player Prefab")); +#endif + if (m_NetworkManager.NetworkConfig.HasOldPrefabList()) { diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs index 0bb73b3a37..4663e327dc 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs @@ -1205,9 +1205,6 @@ internal void Initialize(bool server) UpdateTopology(); - //DANGOEXP TODO: Remove this before finalizing the experimental release - NetworkConfig.AutoSpawnPlayerPrefabClientSide = DistributedAuthorityMode; - // Make sure the ServerShutdownState is reset when initializing if (server) { From 31468cadd74b44aa53ffdc5f9e395dbc745598c5 Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Fri, 11 Oct 2024 11:37:11 -0500 Subject: [PATCH 3/5] update moving property down --- com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index 2fc833dc69..0d6677a110 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -247,10 +247,11 @@ private void DisplayNetworkManagerProperties() EditorGUILayout.Space(); EditorGUILayout.LabelField("Prefab Settings", EditorStyles.boldLabel); EditorGUILayout.PropertyField(m_ForceSamePrefabsProperty); - EditorGUILayout.PropertyField(m_PlayerPrefabProperty, new GUIContent("Default Player Prefab")); #if MULTIPLAYER_SERVICES_SDK_INSTALLED EditorGUILayout.PropertyField(m_AutoSpawnPlayerPrefabClientSide, new GUIContent("Auto Spawn Player Prefab")); #endif + EditorGUILayout.PropertyField(m_PlayerPrefabProperty, new GUIContent("Default Player Prefab")); + if (m_NetworkManager.NetworkConfig.HasOldPrefabList()) From e897d5777b0cf08c8eb5c80238bf7d3835100e04 Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Fri, 11 Oct 2024 12:24:52 -0500 Subject: [PATCH 4/5] update adding changelog entries --- com.unity.netcode.gameobjects/CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index 32fea4c828..ee023124f0 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -9,7 +9,8 @@ Additional documentation and release notes are available at [Multiplayer Documen [Unreleased] ### 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) @@ -25,6 +26,8 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Changed +- Changed `NetworkConfig.AutoSpawnPlayerPrefabClientSide` is no longer automatically set when starting `NetworkManager`. (#3097) + ## [2.0.0] - 2024-09-12 ### Added From d55333b9499620a48ac12c81236537d065604e17 Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Mon, 14 Oct 2024 17:58:32 -0500 Subject: [PATCH 5/5] update Only show the AutoSpawnPlayerPrefabClientSide property in the inspector view if the NetworkManager instance is configured to use the distributed authority network topology. --- .../Editor/NetworkManagerEditor.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index 0d6677a110..8805b4cfbf 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -111,7 +111,11 @@ private void Initialize() m_TickRateProperty = m_NetworkConfigProperty.FindPropertyRelative("TickRate"); #if MULTIPLAYER_SERVICES_SDK_INSTALLED m_NetworkTopologyProperty = m_NetworkConfigProperty.FindPropertyRelative("NetworkTopology"); - m_AutoSpawnPlayerPrefabClientSide = m_NetworkConfigProperty.FindPropertyRelative("AutoSpawnPlayerPrefabClientSide"); + // Only display the auto spawn property when the distributed authority network topology is selected + if (m_NetworkManager.NetworkConfig.NetworkTopology == NetworkTopologyTypes.DistributedAuthority) + { + m_AutoSpawnPlayerPrefabClientSide = m_NetworkConfigProperty.FindPropertyRelative("AutoSpawnPlayerPrefabClientSide"); + } #endif m_ClientConnectionBufferTimeoutProperty = m_NetworkConfigProperty.FindPropertyRelative("ClientConnectionBufferTimeout"); m_ConnectionApprovalProperty = m_NetworkConfigProperty.FindPropertyRelative("ConnectionApproval"); @@ -155,7 +159,11 @@ private void CheckNullProperties() m_TickRateProperty = m_NetworkConfigProperty.FindPropertyRelative("TickRate"); #if MULTIPLAYER_SERVICES_SDK_INSTALLED m_NetworkTopologyProperty = m_NetworkConfigProperty.FindPropertyRelative("NetworkTopology"); - m_AutoSpawnPlayerPrefabClientSide = m_NetworkConfigProperty.FindPropertyRelative("AutoSpawnPlayerPrefabClientSide"); + // Only display the auto spawn property when the distributed authority network topology is selected + if (m_NetworkManager.NetworkConfig.NetworkTopology == NetworkTopologyTypes.DistributedAuthority) + { + m_AutoSpawnPlayerPrefabClientSide = m_NetworkConfigProperty.FindPropertyRelative("AutoSpawnPlayerPrefabClientSide"); + } #endif m_ClientConnectionBufferTimeoutProperty = m_NetworkConfigProperty.FindPropertyRelative("ClientConnectionBufferTimeout"); m_ConnectionApprovalProperty = m_NetworkConfigProperty.FindPropertyRelative("ConnectionApproval"); @@ -248,7 +256,11 @@ private void DisplayNetworkManagerProperties() EditorGUILayout.LabelField("Prefab Settings", EditorStyles.boldLabel); EditorGUILayout.PropertyField(m_ForceSamePrefabsProperty); #if MULTIPLAYER_SERVICES_SDK_INSTALLED - EditorGUILayout.PropertyField(m_AutoSpawnPlayerPrefabClientSide, new GUIContent("Auto Spawn Player Prefab")); + // Only display the auto spawn property when the distributed authority network topology is selected + if (m_NetworkManager.NetworkConfig.NetworkTopology == NetworkTopologyTypes.DistributedAuthority) + { + EditorGUILayout.PropertyField(m_AutoSpawnPlayerPrefabClientSide, new GUIContent("Auto Spawn Player Prefab")); + } #endif EditorGUILayout.PropertyField(m_PlayerPrefabProperty, new GUIContent("Default Player Prefab"));