Skip to content

Commit 6b459a1

Browse files
fix: minor fixes for 2.1.0 (#3097)
* style Spelling fix for error message * 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. * update moving property down * update adding changelog entries * update Only show the AutoSpawnPlayerPrefabClientSide property in the inspector view if the NetworkManager instance is configured to use the distributed authority network topology.
1 parent 3625247 commit 6b459a1

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ Additional documentation and release notes are available at [Multiplayer Documen
99
[Unreleased]
1010

1111
### Added
12-
12+
13+
- Added ability to edit the `NetworkConfig.AutoSpawnPlayerPrefabClientSide` within the inspector view. (#3097)
1314
- Added `IContactEventHandlerWithInfo` that derives from `IContactEventHandler` that can be updated per frame to provide `ContactEventHandlerInfo` information to the `RigidbodyContactEventManager` when processing collisions. (#3094)
1415
- `ContactEventHandlerInfo.ProvideNonRigidBodyContactEvents`: When set to true, non-`Rigidbody` collisions with the registered `Rigidbody` will generate contact event notifications. (#3094)
1516
- `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)
@@ -27,6 +28,8 @@ Additional documentation and release notes are available at [Multiplayer Documen
2728

2829
### Changed
2930

31+
- Changed `NetworkConfig.AutoSpawnPlayerPrefabClientSide` is no longer automatically set when starting `NetworkManager`. (#3097)
32+
3033
## [2.0.0] - 2024-09-12
3134

3235
### Added

com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class NetworkManagerEditor : NetcodeEditorBase<NetworkManager>
3131
private SerializedProperty m_NetworkTransportProperty;
3232
private SerializedProperty m_TickRateProperty;
3333
#if MULTIPLAYER_SERVICES_SDK_INSTALLED
34+
private SerializedProperty m_AutoSpawnPlayerPrefabClientSide;
3435
private SerializedProperty m_NetworkTopologyProperty;
3536
#endif
3637
private SerializedProperty m_ClientConnectionBufferTimeoutProperty;
@@ -104,6 +105,11 @@ private void Initialize()
104105
m_TickRateProperty = m_NetworkConfigProperty.FindPropertyRelative("TickRate");
105106
#if MULTIPLAYER_SERVICES_SDK_INSTALLED
106107
m_NetworkTopologyProperty = m_NetworkConfigProperty.FindPropertyRelative("NetworkTopology");
108+
// Only display the auto spawn property when the distributed authority network topology is selected
109+
if (m_NetworkManager.NetworkConfig.NetworkTopology == NetworkTopologyTypes.DistributedAuthority)
110+
{
111+
m_AutoSpawnPlayerPrefabClientSide = m_NetworkConfigProperty.FindPropertyRelative("AutoSpawnPlayerPrefabClientSide");
112+
}
107113
#endif
108114
m_ClientConnectionBufferTimeoutProperty = m_NetworkConfigProperty.FindPropertyRelative("ClientConnectionBufferTimeout");
109115
m_ConnectionApprovalProperty = m_NetworkConfigProperty.FindPropertyRelative("ConnectionApproval");
@@ -142,6 +148,11 @@ private void CheckNullProperties()
142148
m_TickRateProperty = m_NetworkConfigProperty.FindPropertyRelative("TickRate");
143149
#if MULTIPLAYER_SERVICES_SDK_INSTALLED
144150
m_NetworkTopologyProperty = m_NetworkConfigProperty.FindPropertyRelative("NetworkTopology");
151+
// Only display the auto spawn property when the distributed authority network topology is selected
152+
if (m_NetworkManager.NetworkConfig.NetworkTopology == NetworkTopologyTypes.DistributedAuthority)
153+
{
154+
m_AutoSpawnPlayerPrefabClientSide = m_NetworkConfigProperty.FindPropertyRelative("AutoSpawnPlayerPrefabClientSide");
155+
}
145156
#endif
146157
m_ClientConnectionBufferTimeoutProperty = m_NetworkConfigProperty.FindPropertyRelative("ClientConnectionBufferTimeout");
147158
m_ConnectionApprovalProperty = m_NetworkConfigProperty.FindPropertyRelative("ConnectionApproval");
@@ -221,8 +232,17 @@ private void DisplayNetworkManagerProperties()
221232
EditorGUILayout.Space();
222233
EditorGUILayout.LabelField("Prefab Settings", EditorStyles.boldLabel);
223234
EditorGUILayout.PropertyField(m_ForceSamePrefabsProperty);
235+
#if MULTIPLAYER_SERVICES_SDK_INSTALLED
236+
// Only display the auto spawn property when the distributed authority network topology is selected
237+
if (m_NetworkManager.NetworkConfig.NetworkTopology == NetworkTopologyTypes.DistributedAuthority)
238+
{
239+
EditorGUILayout.PropertyField(m_AutoSpawnPlayerPrefabClientSide, new GUIContent("Auto Spawn Player Prefab"));
240+
}
241+
#endif
224242
EditorGUILayout.PropertyField(m_PlayerPrefabProperty, new GUIContent("Default Player Prefab"));
225243

244+
245+
226246
if (m_NetworkManager.NetworkConfig.HasOldPrefabList())
227247
{
228248
EditorGUILayout.HelpBox("Network Prefabs serialized in old format. Migrate to new format to edit the list.", MessageType.Info);

com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,9 +1161,6 @@ internal void Initialize(bool server)
11611161

11621162
UpdateTopology();
11631163

1164-
//DANGOEXP TODO: Remove this before finalizing the experimental release
1165-
NetworkConfig.AutoSpawnPlayerPrefabClientSide = DistributedAuthorityMode;
1166-
11671164
// Make sure the ServerShutdownState is reset when initializing
11681165
if (server)
11691166
{

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public void DeferDespawn(int tickOffset, bool destroy = true)
336336

337337
if (!HasAuthority)
338338
{
339-
NetworkLog.LogError($"Only the authoirty can invoke {nameof(DeferDespawn)} and local Client-{NetworkManager.LocalClientId} is not the authority of {name}!");
339+
NetworkLog.LogError($"Only the authority can invoke {nameof(DeferDespawn)} and local Client-{NetworkManager.LocalClientId} is not the authority of {name}!");
340340
return;
341341
}
342342

0 commit comments

Comments
 (0)