diff --git a/.github/workflows/pr-description-validation.yml b/.github/workflows/pr-description-validation.yml index 9d2b4ccc75..740fadb922 100644 --- a/.github/workflows/pr-description-validation.yml +++ b/.github/workflows/pr-description-validation.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Check PR description uses: actions/github-script@v9 diff --git a/.github/workflows/pr-supervisor.yaml b/.github/workflows/pr-supervisor.yaml index ba8da21e93..2326b8da4e 100644 --- a/.github/workflows/pr-supervisor.yaml +++ b/.github/workflows/pr-supervisor.yaml @@ -25,7 +25,7 @@ jobs: timeout-minutes: 720 steps: - name: Checkout repository - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Wait and Verify Yamato Job Status env: diff --git a/.yamato/project.metafile b/.yamato/project.metafile index b8862713c9..0dbc457da3 100644 --- a/.yamato/project.metafile +++ b/.yamato/project.metafile @@ -23,7 +23,7 @@ small_agent_platform: - name: ubuntu type: Unity::VM - image: package-ci/ubuntu-22.04:v4.85.0 + image: package-ci/ubuntu-22.04:v4.86.0 flavor: b1.small @@ -38,13 +38,13 @@ test_platforms: default: - name: ubuntu type: Unity::VM - image: package-ci/ubuntu-22.04:v4.85.0 + image: package-ci/ubuntu-22.04:v4.86.0 flavor: b1.large standalone: StandaloneLinux64 desktop: - name: ubuntu type: Unity::VM - image: package-ci/ubuntu-22.04:v4.85.0 + image: package-ci/ubuntu-22.04:v4.86.0 flavor: b1.large smaller_flavor: b1.medium standalone: StandaloneLinux64 diff --git a/.yamato/wrench/api-validation-jobs.yml b/.yamato/wrench/api-validation-jobs.yml index 6976c10973..1b9106d777 100644 --- a/.yamato/wrench/api-validation-jobs.yml +++ b/.yamato/wrench/api-validation-jobs.yml @@ -60,8 +60,8 @@ api_validation_-_netcode_gameobjects_-_6000_0_-_win10: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 2.9.0.0 + UPMPVP_CONTEXT_WRENCH: 3.2.0.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 diff --git a/.yamato/wrench/package-pack-jobs.yml b/.yamato/wrench/package-pack-jobs.yml index 06c750a127..fec8ec8847 100644 --- a/.yamato/wrench/package-pack-jobs.yml +++ b/.yamato/wrench/package-pack-jobs.yml @@ -29,5 +29,5 @@ package_pack_-_netcode_gameobjects: UPMCI_ACK_LARGE_PACKAGE: 1 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 diff --git a/.yamato/wrench/preview-a-p-v.yml b/.yamato/wrench/preview-a-p-v.yml index 47bcafd6dc..15ef42849b 100644 --- a/.yamato/wrench/preview-a-p-v.yml +++ b/.yamato/wrench/preview-a-p-v.yml @@ -15,7 +15,7 @@ all_preview_apv_jobs: - path: .yamato/wrench/preview-a-p-v.yml#preview_apv_-_6000_0_-_win10 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 # Functional tests for dependents found in the latest 6000.0 manifest (MacOS). preview_apv_-_6000_0_-_macos13: @@ -70,10 +70,10 @@ preview_apv_-_6000_0_-_macos13: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 2.9.0.0 + UPMPVP_CONTEXT_WRENCH: 3.2.0.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 # Functional tests for dependents found in the latest 6000.0 manifest (Ubuntu). preview_apv_-_6000_0_-_ubuntu2204: @@ -128,10 +128,10 @@ preview_apv_-_6000_0_-_ubuntu2204: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 2.9.0.0 + UPMPVP_CONTEXT_WRENCH: 3.2.0.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 # Functional tests for dependents found in the latest 6000.0 manifest (Windows). preview_apv_-_6000_0_-_win10: @@ -187,8 +187,8 @@ preview_apv_-_6000_0_-_win10: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 2.9.0.0 + UPMPVP_CONTEXT_WRENCH: 3.2.0.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 diff --git a/.yamato/wrench/promotion-jobs.yml b/.yamato/wrench/promotion-jobs.yml index fb0acbbece..2182edc21c 100644 --- a/.yamato/wrench/promotion-jobs.yml +++ b/.yamato/wrench/promotion-jobs.yml @@ -63,10 +63,10 @@ publish_dry_run_netcode_gameobjects: unzip: true variables: UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 2.9.0.0 + UPMPVP_CONTEXT_WRENCH: 3.2.0.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 # Publish for netcode.gameobjects to https://artifactory-slo.bf.unity3d.com/artifactory/api/npm/upm-npm publish_netcode_gameobjects: @@ -125,9 +125,9 @@ publish_netcode_gameobjects: unzip: true variables: UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 2.9.0.0 + UPMPVP_CONTEXT_WRENCH: 3.2.0.0 allow_on: branch match "^release/.*" metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 diff --git a/.yamato/wrench/recipe-regeneration.yml b/.yamato/wrench/recipe-regeneration.yml index b9eba06e54..34d5f02642 100644 --- a/.yamato/wrench/recipe-regeneration.yml +++ b/.yamato/wrench/recipe-regeneration.yml @@ -31,5 +31,5 @@ test_-_wrench_jobs_up_to_date: cancel_old_ci: true metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 diff --git a/.yamato/wrench/validation-jobs.yml b/.yamato/wrench/validation-jobs.yml index 61b634ea9a..447028d827 100644 --- a/.yamato/wrench/validation-jobs.yml +++ b/.yamato/wrench/validation-jobs.yml @@ -69,10 +69,10 @@ validate_-_netcode_gameobjects_-_6000_0_-_macos13: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 2.9.0.0 + UPMPVP_CONTEXT_WRENCH: 3.2.0.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 labels: - Packages:netcode.gameobjects @@ -139,10 +139,10 @@ validate_-_netcode_gameobjects_-_6000_0_-_ubuntu2204: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 2.9.0.0 + UPMPVP_CONTEXT_WRENCH: 3.2.0.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 labels: - Packages:netcode.gameobjects @@ -209,10 +209,10 @@ validate_-_netcode_gameobjects_-_6000_0_-_win10: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 2.9.0.0 + UPMPVP_CONTEXT_WRENCH: 3.2.0.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 2.9.0.0 + Wrench: 3.2.0.0 labels: - Packages:netcode.gameobjects diff --git a/.yamato/wrench/wrench_config.json b/.yamato/wrench/wrench_config.json index 310007bff5..461e63a9ad 100644 --- a/.yamato/wrench/wrench_config.json +++ b/.yamato/wrench/wrench_config.json @@ -39,7 +39,7 @@ }, "publishing_job": ".yamato/wrench/promotion-jobs.yml#publish_netcode_gameobjects", "branch_pattern": "ReleaseSlash", - "wrench_version": "2.9.0.0", + "wrench_version": "3.2.0.0", "pvp_exemption_path": ".yamato/wrench/pvp-exemptions.json", "cs_project_path": "Tools/CI/NGO.Cookbook.csproj" } \ No newline at end of file diff --git a/Tools/CI/NGO.Cookbook.csproj b/Tools/CI/NGO.Cookbook.csproj index 452a22131a..ef0ba3d3bc 100644 --- a/Tools/CI/NGO.Cookbook.csproj +++ b/Tools/CI/NGO.Cookbook.csproj @@ -8,11 +8,11 @@ - - - - - + + + + + diff --git a/Tools/scripts/ReleaseAutomation/release_config.py b/Tools/scripts/ReleaseAutomation/release_config.py index 7b1332ba99..2fa9c0005b 100644 --- a/Tools/scripts/ReleaseAutomation/release_config.py +++ b/Tools/scripts/ReleaseAutomation/release_config.py @@ -90,57 +90,30 @@ def __init__(self): self.yamato_build_automation_configs = [ { - "job_name": "Build Sample for Windows with minimal supported editor (2022.3), burst ON, IL2CPP", + "job_name": "Build Sample for Windows with supported editor (6000.0), burst ON, IL2CPP", "variables": [ { "key": "BURST_ON_OFF", "value": "on" }, { "key": "PLATFORM_WIN64_MAC_ANDROID", "value": "win64" }, { "key": "SCRIPTING_BACKEND_IL2CPP_MONO", "value": "il2cpp" }, - { "key": "UNITY_VERSION", "value": "2022.3" } # Minimal supported editor + { "key": "UNITY_VERSION", "value": "6000.0" } ] }, { - "job_name": "Build Sample for Windows with latest functional editor (6000.3), burst ON, IL2CPP", - "variables": [ - { "key": "BURST_ON_OFF", "value": "on" }, - { "key": "PLATFORM_WIN64_MAC_ANDROID", "value": "win64" }, - { "key": "SCRIPTING_BACKEND_IL2CPP_MONO", "value": "il2cpp" }, - { "key": "UNITY_VERSION", "value": "6000.3" } # Editor that most our users will use (not alpha). Sometimes when testing on trunk we have weird editor issues not caused by us so the preference will be to test on latest editor that our users will use. - ] - }, - { - "job_name": "Build Sample for MacOS with minimal supported editor (2022.3), burst OFF, Mono", + "job_name": "Build Sample for MacOS with supported editor (6000.0), burst OFF, Mono", "variables": [ { "key": "BURST_ON_OFF", "value": "off" }, { "key": "PLATFORM_WIN64_MAC_ANDROID", "value": "mac" }, { "key": "SCRIPTING_BACKEND_IL2CPP_MONO", "value": "mono" }, - { "key": "UNITY_VERSION", "value": "2022.3" } # Minimal supported editor - ] - }, - { - "job_name": "Build Sample for MacOS with latest functional editor (6000.3), burst OFF, Mono", - "variables": [ - { "key": "BURST_ON_OFF", "value": "off" }, - { "key": "PLATFORM_WIN64_MAC_ANDROID", "value": "mac" }, - { "key": "SCRIPTING_BACKEND_IL2CPP_MONO", "value": "mono" }, - { "key": "UNITY_VERSION", "value": "6000.3" } # Editor that most our users will use (not alpha). Sometimes when testing on trunk we have weird editor issues not caused by us so the preference will be to test on latest editor that our users will use. - ] - }, - { - "job_name": "Build Sample for Android with minimal supported editor (2022.3), burst ON, IL2CPP", - "variables": [ - { "key": "BURST_ON_OFF", "value": "on" }, - { "key": "PLATFORM_WIN64_MAC_ANDROID", "value": "android" }, - { "key": "SCRIPTING_BACKEND_IL2CPP_MONO", "value": "il2cpp" }, - { "key": "UNITY_VERSION", "value": "2022.3" } # Minimal supported editor + { "key": "UNITY_VERSION", "value": "6000.0" } ] }, { - "job_name": "Build Sample for Android with latest functional editor (6000.3), burst ON, IL2CPP", + "job_name": "Build Sample for Android with supported editor (6000.0), burst ON, IL2CPP", "variables": [ { "key": "BURST_ON_OFF", "value": "on" }, { "key": "PLATFORM_WIN64_MAC_ANDROID", "value": "android" }, { "key": "SCRIPTING_BACKEND_IL2CPP_MONO", "value": "il2cpp" }, - { "key": "UNITY_VERSION", "value": "6000.3" } # Editor that most our users will use (not alpha). Sometimes when testing on trunk we have weird editor issues not caused by us so the preference will be to test on latest editor that our users will use. + { "key": "UNITY_VERSION", "value": "6000.0" } ] } ] diff --git a/com.unity.netcode.gameobjects/Components/NetworkAnimator.cs b/com.unity.netcode.gameobjects/Components/NetworkAnimator.cs index 3869fe9ce4..e8fb3f5378 100644 --- a/com.unity.netcode.gameobjects/Components/NetworkAnimator.cs +++ b/com.unity.netcode.gameobjects/Components/NetworkAnimator.cs @@ -1093,24 +1093,24 @@ private unsafe void WriteParameters(ref FastBufferWriter writer) } } else // Note: Triggers are treated like boolean values - if (cacheValue.Type == AnimationParamEnumWrapper.AnimatorControllerParameterBool) - { - var valueBool = m_Animator.GetBool(hash); - fixed (void* value = cacheValue.Value) + if (cacheValue.Type == AnimationParamEnumWrapper.AnimatorControllerParameterBool) { - UnsafeUtility.WriteArrayElement(value, 0, valueBool); - BytePacker.WriteValuePacked(writer, valueBool); + var valueBool = m_Animator.GetBool(hash); + fixed (void* value = cacheValue.Value) + { + UnsafeUtility.WriteArrayElement(value, 0, valueBool); + BytePacker.WriteValuePacked(writer, valueBool); + } } - } - else if (cacheValue.Type == AnimationParamEnumWrapper.AnimatorControllerParameterFloat) - { - var valueFloat = m_Animator.GetFloat(hash); - fixed (void* value = cacheValue.Value) + else if (cacheValue.Type == AnimationParamEnumWrapper.AnimatorControllerParameterFloat) { - UnsafeUtility.WriteArrayElement(value, 0, valueFloat); - BytePacker.WriteValuePacked(writer, valueFloat); + var valueFloat = m_Animator.GetFloat(hash); + fixed (void* value = cacheValue.Value) + { + UnsafeUtility.WriteArrayElement(value, 0, valueFloat); + BytePacker.WriteValuePacked(writer, valueFloat); + } } - } } } diff --git a/com.unity.netcode.gameobjects/Components/NetworkTransform.cs b/com.unity.netcode.gameobjects/Components/NetworkTransform.cs index e87293925d..a1484091ff 100644 --- a/com.unity.netcode.gameobjects/Components/NetworkTransform.cs +++ b/com.unity.netcode.gameobjects/Components/NetworkTransform.cs @@ -2026,23 +2026,23 @@ private bool ApplyTransformToNetworkStateWithInfo(ref NetworkTransformState netw } } else // Just apply the full local scale when synchronizing - if (SynchronizeScale) - { - if (!UseHalfFloatPrecision) - { - networkState.ScaleX = transform.localScale.x; - networkState.ScaleY = transform.localScale.y; - networkState.ScaleZ = transform.localScale.z; - } - else + if (SynchronizeScale) { - networkState.Scale = transform.localScale; + if (!UseHalfFloatPrecision) + { + networkState.ScaleX = transform.localScale.x; + networkState.ScaleY = transform.localScale.y; + networkState.ScaleZ = transform.localScale.z; + } + else + { + networkState.Scale = transform.localScale; + } + networkState.HasScaleX = true; + networkState.HasScaleY = true; + networkState.HasScaleZ = true; + isScaleDirty = true; } - networkState.HasScaleX = true; - networkState.HasScaleY = true; - networkState.HasScaleZ = true; - isScaleDirty = true; - } isDirty |= isPositionDirty || isRotationDirty || isScaleDirty; if (isDirty) @@ -2768,10 +2768,10 @@ private void NetworkTickSystem_Tick() m_TargetPosition = GetSpaceRelativePosition(); } else // If we are no longer authority, unsubscribe to the tick event - if (NetworkManager != null && NetworkManager.NetworkTickSystem != null) - { - NetworkManager.NetworkTickSystem.Tick -= NetworkTickSystem_Tick; - } + if (NetworkManager != null && NetworkManager.NetworkTickSystem != null) + { + NetworkManager.NetworkTickSystem.Tick -= NetworkTickSystem_Tick; + } } /// diff --git a/com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs b/com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs index 994b1d94cd..8c59d5cb83 100644 --- a/com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs +++ b/com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs @@ -2088,14 +2088,14 @@ private bool GetReadMethodForParameter(TypeReference paramType, out MethodRefere } else #endif - if (paramType.Resolve().FullName == "Unity.Collections.NativeArray`1") - { - typeMethod = GetFastBufferReaderReadMethod(k_ReadValueTempMethodName, paramType); - } - else - { - typeMethod = GetFastBufferReaderReadMethod(k_ReadValueMethodName, paramType); - } + if (paramType.Resolve().FullName == "Unity.Collections.NativeArray`1") + { + typeMethod = GetFastBufferReaderReadMethod(k_ReadValueTempMethodName, paramType); + } + else + { + typeMethod = GetFastBufferReaderReadMethod(k_ReadValueMethodName, paramType); + } if (typeMethod != null) { methodRef = m_MainModule.ImportReference(typeMethod); diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerHelper.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerHelper.cs index 3138369d57..37881202ba 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerHelper.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerHelper.cs @@ -196,10 +196,10 @@ public bool NotifyUserOfNestedNetworkManager(NetworkManager networkManager, bool return isParented; } else // If we are no longer a child, then we can remove ourself from this list - if (transform.root == gameObject.transform) - { - s_LastKnownNetworkManagerParents.Remove(networkManager); - } + if (transform.root == gameObject.transform) + { + s_LastKnownNetworkManagerParents.Remove(networkManager); + } } if (!EditorApplication.isUpdating && isParented) { diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs index 7ce31f5871..1078f1b86c 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs @@ -1152,10 +1152,10 @@ internal void WriteNetworkVariableData(FastBufferWriter writer, ulong targetClie } } else // Only if EnsureNetworkVariableLengthSafety, otherwise just skip - if (NetworkManager.NetworkConfig.EnsureNetworkVariableLengthSafety) - { - writer.WriteValueSafe(0); - } + if (NetworkManager.NetworkConfig.EnsureNetworkVariableLengthSafety) + { + writer.WriteValueSafe(0); + } } } @@ -1183,10 +1183,10 @@ internal void SetNetworkVariableData(FastBufferReader reader, ulong clientId) readStartPos = reader.Position; } else // If the client cannot read this field, then skip it - if (!field.CanClientRead(clientId)) - { - continue; - } + if (!field.CanClientRead(clientId)) + { + continue; + } field.ReadField(reader); diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs index 351d979f50..1d456a7e44 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs @@ -1179,31 +1179,31 @@ private void OnTransformParentChanged() Debug.LogException(new NotServerException($"Only the server can reparent {nameof(NetworkObject)}s")); } else // Otherwise, if we are removing a parent then go ahead and allow parenting to occur - if (transform.parent == null) - { - m_LatestParent = null; - m_CachedParent = null; - InvokeBehaviourOnNetworkObjectParentChanged(null); - } + if (transform.parent == null) + { + m_LatestParent = null; + m_CachedParent = null; + InvokeBehaviourOnNetworkObjectParentChanged(null); + } return; } else // Otherwise, on the serer side if this instance is not spawned... - if (!IsSpawned) - { - // ,,,and we are removing the parent, then go ahead and allow parenting to occur - if (transform.parent == null) + if (!IsSpawned) { - m_LatestParent = null; - m_CachedParent = null; - InvokeBehaviourOnNetworkObjectParentChanged(null); - } - else - { - transform.parent = m_CachedParent; - Debug.LogException(new SpawnStateException($"{nameof(NetworkObject)} can only be reparented after being spawned")); + // ,,,and we are removing the parent, then go ahead and allow parenting to occur + if (transform.parent == null) + { + m_LatestParent = null; + m_CachedParent = null; + InvokeBehaviourOnNetworkObjectParentChanged(null); + } + else + { + transform.parent = m_CachedParent; + Debug.LogException(new SpawnStateException($"{nameof(NetworkObject)} can only be reparented after being spawned")); + } + return; } - return; - } var removeParent = false; var parentTransform = transform.parent; if (parentTransform != null) @@ -1317,25 +1317,25 @@ internal bool ApplyNetworkParenting(bool removeParent = false, bool ignoreNotSpa return true; } else // If the parent still isn't spawned add this to the orphaned children and return false - if (!parentNetworkObject.IsSpawned) - { - OrphanChildren.Add(this); - return false; - } - else - { - // If we made it this far, go ahead and set the network parenting values - // with the WorldPoisitonSays value set to false - // Note: Since in-scene placed NetworkObjects are parented in the scene - // the default "assumption" is that children are parenting local space - // relative. - SetNetworkParenting(parentNetworkObject.NetworkObjectId, false); + if (!parentNetworkObject.IsSpawned) + { + OrphanChildren.Add(this); + return false; + } + else + { + // If we made it this far, go ahead and set the network parenting values + // with the WorldPoisitonSays value set to false + // Note: Since in-scene placed NetworkObjects are parented in the scene + // the default "assumption" is that children are parenting local space + // relative. + SetNetworkParenting(parentNetworkObject.NetworkObjectId, false); - // Set the cached parent - m_CachedParent = parentNetworkObject.transform; + // Set the cached parent + m_CachedParent = parentNetworkObject.transform; - return true; - } + return true; + } } // If we are removing the parent or our latest parent is not set, then remove the parent @@ -2076,16 +2076,16 @@ internal void SceneChangedUpdate(Scene scene, bool notify = false) NetworkSceneHandle = SceneOriginHandle; } else // Otherwise, the client did not find the client to server scene handle - if (NetworkManager.LogLevel == LogLevel.Developer) - { - // There could be a scenario where a user has some client-local scene loaded that they migrate the NetworkObject - // into, but that scenario seemed very edge case and under most instances a user should be notified that this - // server - client scene handle mismatch has occurred. It also seemed pertinent to make the message replicate to - // the server-side too. - NetworkLog.LogWarningServer($"[Client-{NetworkManager.LocalClientId}][{gameObject.name}] Server - " + - $"client scene mismatch detected! Client-side scene handle ({SceneOriginHandle}) for scene ({gameObject.scene.name})" + - $"has no associated server side (network) scene handle!"); - } + if (NetworkManager.LogLevel == LogLevel.Developer) + { + // There could be a scenario where a user has some client-local scene loaded that they migrate the NetworkObject + // into, but that scenario seemed very edge case and under most instances a user should be notified that this + // server - client scene handle mismatch has occurred. It also seemed pertinent to make the message replicate to + // the server-side too. + NetworkLog.LogWarningServer($"[Client-{NetworkManager.LocalClientId}][{gameObject.name}] Server - " + + $"client scene mismatch detected! Client-side scene handle ({SceneOriginHandle}) for scene ({gameObject.scene.name})" + + $"has no associated server side (network) scene handle!"); + } OnMigratedToNewScene?.Invoke(); // Only the server side will notify clients of non-parented NetworkObject scene changes diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs index f42d89ff3b..e354893749 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs @@ -54,7 +54,7 @@ private protected void SendMessageToClient(NetworkBehaviour behaviour, ulong cli #if DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE var size = #endif - behaviour.NetworkManager.MessageManager.SendMessage(ref message, delivery, clientId); + behaviour.NetworkManager.MessageManager.SendMessage(ref message, delivery, clientId); #if DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE if (NetworkBehaviour.__rpc_name_table[behaviour.GetType()].TryGetValue(message.Metadata.NetworkRpcMethodId, out var rpcMethodName)) diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs index 15bb63d307..381cd07564 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs @@ -21,7 +21,7 @@ internal override void Send(NetworkBehaviour behaviour, ref RpcMessage message, #if DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE var size = #endif - behaviour.NetworkManager.MessageManager.SendMessage(ref proxyMessage, delivery, NetworkManager.ServerClientId); + behaviour.NetworkManager.MessageManager.SendMessage(ref proxyMessage, delivery, NetworkManager.ServerClientId); #if DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE if (NetworkBehaviour.__rpc_name_table[behaviour.GetType()].TryGetValue(message.Metadata.NetworkRpcMethodId, out var rpcMethodName)) diff --git a/com.unity.netcode.gameobjects/Runtime/SceneManagement/DefaultSceneManagerHandler.cs b/com.unity.netcode.gameobjects/Runtime/SceneManagement/DefaultSceneManagerHandler.cs index be4e00eace..73f4607de0 100644 --- a/com.unity.netcode.gameobjects/Runtime/SceneManagement/DefaultSceneManagerHandler.cs +++ b/com.unity.netcode.gameobjects/Runtime/SceneManagement/DefaultSceneManagerHandler.cs @@ -342,13 +342,13 @@ public void SetClientSynchronizationMode(ref NetworkManager networkManager, Load return; } else // Warn users if they are changing this after there are clients already connected and synchronized - if (networkManager.ConnectedClientsIds.Count > (networkManager.IsHost ? 1 : 0) && sceneManager.ClientSynchronizationMode != mode) - { - if (NetworkLog.CurrentLogLevel <= LogLevel.Normal) + if (networkManager.ConnectedClientsIds.Count > (networkManager.IsHost ? 1 : 0) && sceneManager.ClientSynchronizationMode != mode) { - NetworkLog.LogWarning("Server is changing client synchronization mode after clients have been synchronized! It is recommended to do this before clients are connected!"); + if (NetworkLog.CurrentLogLevel <= LogLevel.Normal) + { + NetworkLog.LogWarning("Server is changing client synchronization mode after clients have been synchronized! It is recommended to do this before clients are connected!"); + } } - } // For additive client synchronization, we take into consideration scenes // already loaded. diff --git a/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkPrefabHandler.cs b/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkPrefabHandler.cs index db2678822c..84ecb57de7 100644 --- a/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkPrefabHandler.cs +++ b/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkPrefabHandler.cs @@ -288,10 +288,10 @@ internal void HandleNetworkPrefabDestroy(NetworkObject networkObjectInstance) } } else // Otherwise the NetworkObject is the source NetworkPrefab - if (m_PrefabAssetToPrefabHandler.TryGetValue(networkObjectInstanceHash, out var prefabInstanceHandler)) - { - prefabInstanceHandler.Destroy(networkObjectInstance); - } + if (m_PrefabAssetToPrefabHandler.TryGetValue(networkObjectInstanceHash, out var prefabInstanceHandler)) + { + prefabInstanceHandler.Destroy(networkObjectInstance); + } } /// diff --git a/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs b/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs index eb949aecb0..275bd09555 100644 --- a/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs @@ -1024,10 +1024,10 @@ internal void DespawnAndDestroyNetworkObjects() OnDespawnObject(networkObjects[i], shouldDestroy); } else // Otherwise, if we are not spawned and we should destroy...then destroy. - if (shouldDestroy) - { - UnityEngine.Object.Destroy(networkObjects[i].gameObject); - } + if (shouldDestroy) + { + UnityEngine.Object.Destroy(networkObjects[i].gameObject); + } } } } diff --git a/testproject-tools-integration/Packages/manifest.json b/testproject-tools-integration/Packages/manifest.json index a6b8d3335c..5297101770 100644 --- a/testproject-tools-integration/Packages/manifest.json +++ b/testproject-tools-integration/Packages/manifest.json @@ -6,8 +6,8 @@ "com.unity.multiplayer.tools": "2.2.8", "com.unity.netcode.gameobjects": "file:../../com.unity.netcode.gameobjects", "com.unity.test-framework": "1.6.0", - "com.unity.test-framework.performance": "3.4.1", - "com.unity.transport": "2.7.2", + "com.unity.test-framework.performance": "3.4.2", + "com.unity.transport": "2.7.3", "com.unity.modules.accessibility": "1.0.0", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", diff --git a/testproject/Assets/Tests/Manual/Scripts/NetworkPrefabPool.cs b/testproject/Assets/Tests/Manual/Scripts/NetworkPrefabPool.cs index 3035cfcfc0..7a9d632a6e 100644 --- a/testproject/Assets/Tests/Manual/Scripts/NetworkPrefabPool.cs +++ b/testproject/Assets/Tests/Manual/Scripts/NetworkPrefabPool.cs @@ -496,11 +496,11 @@ public void UpdateSpawnsPerSecond() StartSpawningBoxes(); } else //Handle case where spawning coroutine is running but we set our spawn rate to zero - if (SpawnsPerSecond == 0 && m_IsSpawningObjects) - { - m_IsSpawningObjects = false; - StopCoroutine(SpawnObjects()); - } + if (SpawnsPerSecond == 0 && m_IsSpawningObjects) + { + m_IsSpawningObjects = false; + StopCoroutine(SpawnObjects()); + } } } diff --git a/testproject/Assets/Tests/Manual/Scripts/NetworkPrefabPoolAdditive.cs b/testproject/Assets/Tests/Manual/Scripts/NetworkPrefabPoolAdditive.cs index ea2dfc2416..ded7868357 100644 --- a/testproject/Assets/Tests/Manual/Scripts/NetworkPrefabPoolAdditive.cs +++ b/testproject/Assets/Tests/Manual/Scripts/NetworkPrefabPoolAdditive.cs @@ -343,11 +343,11 @@ public void UpdateSpawnsPerSecond() StartSpawningBoxes(); } else //Handle case where spawning coroutine is running but we set our spawn rate to zero - if (SpawnsPerSecond == 0 && m_IsSpawningObjects) - { - m_IsSpawningObjects = false; - InternalStopCoroutine(); - } + if (SpawnsPerSecond == 0 && m_IsSpawningObjects) + { + m_IsSpawningObjects = false; + InternalStopCoroutine(); + } } diff --git a/testproject/Assets/Tests/Runtime/Animation/NetworkAnimatorTests.cs b/testproject/Assets/Tests/Runtime/Animation/NetworkAnimatorTests.cs index 0da96aa45e..77c4d1551e 100644 --- a/testproject/Assets/Tests/Runtime/Animation/NetworkAnimatorTests.cs +++ b/testproject/Assets/Tests/Runtime/Animation/NetworkAnimatorTests.cs @@ -454,10 +454,10 @@ private bool AllObserversSameLayerWeight(OwnerShipMode ownerShipMode, int layer, } } else - if (animatorTestHelper.Value.GetLayerWeight(layer) != targetWeight) - { - return false; - } + if (animatorTestHelper.Value.GetLayerWeight(layer) != targetWeight) + { + return false; + } } return true; }