diff --git a/.github/workflows/pr-description-validation.yml b/.github/workflows/pr-description-validation.yml index adb0b9dfda..268b44b809 100644 --- a/.github/workflows/pr-description-validation.yml +++ b/.github/workflows/pr-description-validation.yml @@ -30,18 +30,18 @@ jobs: script: | const pr = context.payload.pull_request; const body = pr.body || ''; - - // List of users to skip description validation + + // List of user patterns to skip description validation // This should be automations where we don't care that much about the description format - const skipUsersPrefixes = [ - 'unity-renovate', - 'svc-' + const skipUserPatterns = [ + /^unity-renovate/, + /svc/ ]; - // If PR author is in the skip list, exit early + // If PR author matches the skip list, exit early const author = pr.user.login; console.log(`PR author: ${author}`); - if (skipUsersPrefixes.some(prefix => author.startsWith(prefix))) { + if (skipUserPatterns.some(pattern => pattern.test(author))) { console.log(`Skipping PR description check for user: ${author}`); return; } diff --git a/.yamato/console-standalone-test.yml b/.yamato/console-standalone-test.yml index dba4a796a1..9574e07e1b 100644 --- a/.yamato/console-standalone-test.yml +++ b/.yamato/console-standalone-test.yml @@ -31,7 +31,6 @@ # Each console requires specific SDK paths and tools # QUALITY THOUGHTS-------------------------------------------------------------------- - # TODO: consider adding all projects that have tests # To see where this job is included (in trigger job definitions) look into _triggers.yml file @@ -51,16 +50,16 @@ console_standalone_build_{{ project.name }}_{{ platform.name }}_{{ editor }}: {% endif %} commands: - unity-downloader-cli --fast --wait -u {{ editor }} -c Editor -c il2cpp -c {{ platform.name }} - - UnifiedTestRunner --testproject={{ project.path }} --architecture={% if platform.name == "switch" %}arm64{% else %}x64{% endif %} --scripting-backend=il2cpp --suite=playmode --platform={{ platform.standalone }} --editor-location=.Editor --artifacts-path=artifacts --player-save-path=build/players --testfilter="Unity.Netcode.RuntimeTests.*" --extra-editor-arg=-batchmode --extra-editor-arg=-nographics --reruncount=1 --clean-library-on-rerun --build-only --timeout={{ test_timeout}} + - UnifiedTestRunner --testproject={{ project.path }} --architecture={% if platform.name == "switch" %}arm64{% else %}x64{% endif %} --scripting-backend=il2cpp --suite=playmode --platform={{ platform.standalone }} --editor-location=.Editor --artifacts-path=artifacts --player-save-path=build/players --testfilter="Unity.Netcode.RuntimeTests.*" --extra-editor-arg=-batchmode --extra-editor-arg=-nographics{% if platform.name == "switch" %} --extra-editor-arg=-overrideTextureCompression --extra-editor-arg=ForceUncompressed{% endif %} --reruncount=1 --clean-library-on-rerun --build-only --timeout={{ test_timeout}} variables: # PS4 related SCE_ORBIS_SDK_DIR: 'C:\Users\bokken\SCE\ps4_sdk_12_00' -# PS5 related --> THIS WAS DISABLED IN PROJECT.METAFILE. SEE MTT-12118 - SCE_PROSPERO_SDK_DIR: 'C:\Program Files (x86)\SCE\Prospero SDKs\9.000' - SHADER_COMPILER_PATH: '${SCE_PROSPERO_SDK_DIR}\target\bins' +# PS5 related --> win10-ps5:v4 ships SDK 13.000 but defaults SCE_PROSPERO_SDK_DIR to an unsupported version, so set it explicitly. + SCE_PROSPERO_SDK_DIR: 'C:\Program Files (x86)\SCE\Prospero SDKs\13.000' + SHADER_COMPILER_PATH: '${SCE_PROSPERO_SDK_DIR}\host_tools\bin' SCE_ROOT_DIR: 'C:\Program Files (x86)\SCE' -# Switch related - NINTENDO_SDK_ROOT: 'C:\Nintendo\nx_sdk-18_3_0\NintendoSDK' +# Switch related --> Switch is DISABLED in project.metafile (MTT-15636): 6000.x/trunk editors mandate NintendoSDK 22.2.x, which is not installed on win10-switch:v4 (only nintendosdk-en-21_4_0 is). This target path is correct for when PETS ships 22.2.x and Switch is re-enabled. + NINTENDO_SDK_ROOT: 'C:\Nintendo\nintendosdk-en-22_2_0\NintendoSDK' UNITY_NINTENDOSDK_CLI_TOOLS: '${NINTENDO_SDK_ROOT}\Tools\CommandLineTools' artifacts: players: @@ -94,12 +93,12 @@ console_standalone_test_{{ project.name }}_{{ platform.name }}_{{ editor }}: variables: # PS4 related SCE_ORBIS_SDK_DIR: 'C:\Users\bokken\SCE\ps4_sdk_12_00' -# PS5 related --> THIS WAS DISABLED IN PROJECT.METAFILE. SEE MTT-12118 - SCE_PROSPERO_SDK_DIR: 'C:\Program Files (x86)\SCE\Prospero SDKs\9.000' - SHADER_COMPILER_PATH: '${SCE_PROSPERO_SDK_DIR}\target\bins' +# PS5 related --> win10-ps5:v4 ships SDK 13.000 but defaults SCE_PROSPERO_SDK_DIR to an unsupported version, so set it explicitly. + SCE_PROSPERO_SDK_DIR: 'C:\Program Files (x86)\SCE\Prospero SDKs\13.000' + SHADER_COMPILER_PATH: '${SCE_PROSPERO_SDK_DIR}\host_tools\bin' SCE_ROOT_DIR: 'C:\Program Files (x86)\SCE' -# Switch related - NINTENDO_SDK_ROOT: 'C:\Nintendo\nx_sdk-18_3_0\NintendoSDK' +# Switch related --> Switch is DISABLED in project.metafile (MTT-15636): 6000.x/trunk editors mandate NintendoSDK 22.2.x, which is not installed on win10-switch:v4 (only nintendosdk-en-21_4_0 is). This target path is correct for when PETS ships 22.2.x and Switch is re-enabled. + NINTENDO_SDK_ROOT: 'C:\Nintendo\nintendosdk-en-22_2_0\NintendoSDK' UNITY_NINTENDOSDK_CLI_TOOLS: '${NINTENDO_SDK_ROOT}\Tools\CommandLineTools' artifacts: logs: diff --git a/.yamato/project.metafile b/.yamato/project.metafile index 1117c4badf..9c92cbac7e 100644 --- a/.yamato/project.metafile +++ b/.yamato/project.metafile @@ -111,18 +111,15 @@ test_platforms: flavor: b1.large larger_flavor: b1.xlarge standalone: PS4 - # - name: ps5 --> SEE MTT-12118 - # type: Unity::VM - # image: package-ci/win10-ps5:v4 - # flavor: b1.large - # larger_flavor: b1.xlarge - # standalone: PS5 - # - name: switch --> TEMPORARILY DISABLED. SEE MTT-12118 - # The NintendoSDK on the win10-switch:v4 Bokken image is incomplete for the SDK - # version the newer editor Playback Engines require: 18_3_0 is missing the - # nintendo-switch-support lib the new toolchain links against, and 21_4_3 is missing the - # Tools\Graphics\NvnTools (GraphicsConverter) libraries needed to package textures. - # Neither is fixable from .yamato; re-enable once Package CI ships a complete SDK on the image. + # ps5: win10-ps5:v4 defaults SCE_PROSPERO_SDK_DIR to an unsupported SDK, so it is overridden to 13.000 in console-standalone-test.yml. + - name: ps5 + type: Unity::VM + image: package-ci/win10-ps5:v4 + flavor: b1.large + larger_flavor: b1.xlarge + standalone: PS5 + # switch --> DISABLED. SEE MTT-15636 (split from MTT-12118). 6000.x/trunk editors mandate NintendoSDK 22.2.x, but package-ci/win10-switch:v4 currently ships only nintendosdk-en-21_4_0. That fixes texture packaging but the native IL2CPP link then fails (undefined symbol std::__1::__hash_memory, from the 22_02 SwitchPlayer.a). Re-enable once PETS publishes a win10-switch image with nintendosdk-en-22_2_x. + # - name: switch # type: Unity::VM # image: package-ci/win10-switch:v4 # flavor: b1.large @@ -147,13 +144,14 @@ test_platforms: flavor: b1.large larger_flavor: b1.xlarge standalone: PS4 - #- name: ps5 --> SEE MTT-12118 - # type: Unity::console::ps5 - # image: package-ci/win10-ps5:v4 - # flavor: b1.large - # larger_flavor: b1.xlarge - # standalone: PS5 - # - name: switch --> TEMPORARILY DISABLED. SEE MTT-12118 (incomplete NintendoSDK on win10-switch:v4 image) + - name: ps5 + type: Unity::console::ps5 + image: package-ci/win10-ps5:v4 + flavor: b1.large + larger_flavor: b1.xlarge + standalone: PS5 + # switch --> DISABLED. SEE MTT-15636 (needs NintendoSDK 22.2.x on the image; see console_build note). + # - name: switch # type: Unity::console::switch # image: package-ci/win10-switch:v4 # flavor: b1.large diff --git a/.yamato/wrench/api-validation-jobs.yml b/.yamato/wrench/api-validation-jobs.yml index 611902cc9a..207c95dc49 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: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 diff --git a/.yamato/wrench/package-pack-jobs.yml b/.yamato/wrench/package-pack-jobs.yml index a40678465b..a5cc623aab 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: 3.2.1.0 + Wrench: 3.3.1.0 diff --git a/.yamato/wrench/preview-a-p-v.yml b/.yamato/wrench/preview-a-p-v.yml index bafc711428..f660b39a15 100644 --- a/.yamato/wrench/preview-a-p-v.yml +++ b/.yamato/wrench/preview-a-p-v.yml @@ -27,7 +27,7 @@ all_preview_apv_jobs: - path: .yamato/wrench/preview-a-p-v.yml#preview_apv_-_6000_7_-_win10 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.0 manifest (MacOS). preview_apv_-_6000_0_-_macos13: @@ -82,10 +82,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: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.0 manifest (Ubuntu). preview_apv_-_6000_0_-_ubuntu2204: @@ -140,10 +140,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: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.0 manifest (Windows). preview_apv_-_6000_0_-_win10: @@ -199,10 +199,10 @@ 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: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.3 manifest (MacOS). preview_apv_-_6000_3_-_macos13: @@ -257,10 +257,10 @@ preview_apv_-_6000_3_-_macos13: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.3 manifest (Ubuntu). preview_apv_-_6000_3_-_ubuntu2204: @@ -315,10 +315,10 @@ preview_apv_-_6000_3_-_ubuntu2204: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.3 manifest (Windows). preview_apv_-_6000_3_-_win10: @@ -374,10 +374,10 @@ preview_apv_-_6000_3_-_win10: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.5 manifest (MacOS). preview_apv_-_6000_5_-_macos13: @@ -432,10 +432,10 @@ preview_apv_-_6000_5_-_macos13: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.5 manifest (Ubuntu). preview_apv_-_6000_5_-_ubuntu2204: @@ -490,10 +490,10 @@ preview_apv_-_6000_5_-_ubuntu2204: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.5 manifest (Windows). preview_apv_-_6000_5_-_win10: @@ -549,10 +549,10 @@ preview_apv_-_6000_5_-_win10: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.6 manifest (MacOS). preview_apv_-_6000_6_-_macos13arm: @@ -608,10 +608,10 @@ preview_apv_-_6000_6_-_macos13arm: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.6 manifest (Ubuntu). preview_apv_-_6000_6_-_ubuntu2204: @@ -666,10 +666,10 @@ preview_apv_-_6000_6_-_ubuntu2204: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.6 manifest (Windows). preview_apv_-_6000_6_-_win10: @@ -725,10 +725,10 @@ preview_apv_-_6000_6_-_win10: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.7 manifest (MacOS). preview_apv_-_6000_7_-_macos13arm: @@ -784,10 +784,10 @@ preview_apv_-_6000_7_-_macos13arm: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.7 manifest (Ubuntu). preview_apv_-_6000_7_-_ubuntu2204: @@ -842,10 +842,10 @@ preview_apv_-_6000_7_-_ubuntu2204: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Functional tests for dependents found in the latest 6000.7 manifest (Windows). preview_apv_-_6000_7_-_win10: @@ -901,8 +901,8 @@ preview_apv_-_6000_7_-_win10: UNITY_LICENSING_SERVER_DELETE_NUL: 0 UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 diff --git a/.yamato/wrench/promotion-jobs.yml b/.yamato/wrench/promotion-jobs.yml index 06dda4cdcf..336bd6b080 100644 --- a/.yamato/wrench/promotion-jobs.yml +++ b/.yamato/wrench/promotion-jobs.yml @@ -183,10 +183,10 @@ publish_dry_run_netcode_gameobjects: unzip: true variables: UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 # Publish for netcode.gameobjects to https://artifactory-slo.bf.unity3d.com/artifactory/api/npm/upm-npm publish_netcode_gameobjects: @@ -365,9 +365,9 @@ publish_netcode_gameobjects: unzip: true variables: UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 allow_on: branch match "^release/.*" metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 diff --git a/.yamato/wrench/recipe-regeneration.yml b/.yamato/wrench/recipe-regeneration.yml index 343a1a9b85..c4f798e8c2 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: 3.2.1.0 + Wrench: 3.3.1.0 diff --git a/.yamato/wrench/validation-jobs.yml b/.yamato/wrench/validation-jobs.yml index 88d03e589b..4a7b6ba365 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: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.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: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.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: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -279,10 +279,10 @@ validate_-_netcode_gameobjects_-_6000_3_-_macos13: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -349,10 +349,10 @@ validate_-_netcode_gameobjects_-_6000_3_-_ubuntu2204: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -419,10 +419,10 @@ validate_-_netcode_gameobjects_-_6000_3_-_win10: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -489,10 +489,10 @@ validate_-_netcode_gameobjects_-_6000_5_-_macos13: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -559,10 +559,10 @@ validate_-_netcode_gameobjects_-_6000_5_-_ubuntu2204: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -629,10 +629,10 @@ validate_-_netcode_gameobjects_-_6000_5_-_win10: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -700,10 +700,10 @@ validate_-_netcode_gameobjects_-_6000_6_-_macos13arm: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -770,10 +770,10 @@ validate_-_netcode_gameobjects_-_6000_6_-_ubuntu2204: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -840,10 +840,10 @@ validate_-_netcode_gameobjects_-_6000_6_-_win10: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -911,10 +911,10 @@ validate_-_netcode_gameobjects_-_6000_7_-_macos13arm: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -981,10 +981,10 @@ validate_-_netcode_gameobjects_-_6000_7_-_ubuntu2204: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects @@ -1051,10 +1051,10 @@ validate_-_netcode_gameobjects_-_6000_7_-_win10: UNITY_LICENSING_SERVER_DELETE_ULF: 0 UNITY_LICENSING_SERVER_TOOLSET: pro UPMPVP_ACK_UPMPVP_DOES_NO_API_VALIDATION: 1 - UPMPVP_CONTEXT_WRENCH: 3.2.1.0 + UPMPVP_CONTEXT_WRENCH: 3.3.1.0 metadata: Job Maintainers: '#rm-packageworks' - Wrench: 3.2.1.0 + Wrench: 3.3.1.0 labels: - Packages:netcode.gameobjects diff --git a/.yamato/wrench/wrench_config.json b/.yamato/wrench/wrench_config.json index 96b58ebf4f..fb5e12dc7b 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": "3.2.1.0", + "wrench_version": "3.3.1.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 e47057e13d..d77b3d4bdb 100644 --- a/Tools/CI/NGO.Cookbook.csproj +++ b/Tools/CI/NGO.Cookbook.csproj @@ -8,11 +8,11 @@ - - + + - + diff --git a/Tools/scripts/BuildAutomation/manifest_update.py b/Tools/scripts/BuildAutomation/manifest_update.py index 0ad8913b8e..1597e2bc39 100644 --- a/Tools/scripts/BuildAutomation/manifest_update.py +++ b/Tools/scripts/BuildAutomation/manifest_update.py @@ -51,7 +51,7 @@ def main(): # Extract the version, providing a default if not found local_package_version = local_package_data.get('version', 'N/A') - print(f"--> Verified local '{args.package-name}' version is: {local_package_version}") + print(f"--> Verified local '{args.package_name}' version is: {local_package_version}") except FileNotFoundError: print(f"Warning: Could not find package.json at '{local_package_json_path}'") diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index 85157fe510..fd673d8ed3 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -19,8 +19,6 @@ Additional documentation and release notes are available at [Multiplayer Documen - `Unity.Netcode.Editor.PackageChecker` → `Unity.Netcode.GameObjects.Editor.PackageChecker` - `Unity.Netcode.Editor.Tests` → `Unity.Netcode.GameObjects.Editor.Tests` - - ### Deprecated @@ -29,10 +27,6 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Fixed -- Issue with not being able to spawn initially disabled in-scene placed objects. (#4093) -- Issue with pre-instantiated network prefab instances being marked as in-scene placed. Now pre-instantiated network prefabs are dynamically spawned. (#4093) -- Issue where a user could spawn runtime created `NetworkObject` that has a GlobalObjectIdHash of zero. These are not valid instances and will no longer be allowed to spawn. (#4093) - ### Security @@ -40,6 +34,17 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Obsolete +## [2.13.2] - 2026-08-16 + + + +### Fixed + +- Issue with not being able to spawn initially disabled in-scene placed objects. (#4093) +- Issue with pre-instantiated network prefab instances being marked as in-scene placed. Now pre-instantiated network prefabs are dynamically spawned. (#4093) +- Issue where a user could spawn runtime created `NetworkObject` that has a GlobalObjectIdHash of zero. These are not valid instances and will no longer be allowed to spawn. (#4093) + + ## [2.13.1] - 2026-07-19 ### Added diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/NetworkVariableDeltaMessage.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/NetworkVariableDeltaMessage.cs index 11fe2e2a7e..3e4c6a0541 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/NetworkVariableDeltaMessage.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/NetworkVariableDeltaMessage.cs @@ -47,7 +47,7 @@ internal struct NetworkVariableDeltaMessage : INetworkMessage private Dictionary> m_ForwardUpdates; - private List m_UpdatedNetworkVariables; + private NativeList m_UpdatedNetworkVariables; [MethodImpl(MethodImplOptions.AggressiveInlining)] private void WriteNetworkVariable(ref FastBufferWriter writer, ref NetworkVariableBase networkVariable, bool ensureNetworkVariableLengthSafety, int nonfragmentedSize, int fragmentedSize) @@ -217,7 +217,7 @@ public void Handle(ref NetworkContext context) var networkBehaviour = networkObject.GetNetworkBehaviourAtOrderIndex(NetworkBehaviourIndex); var isServerAndDeltaForwarding = m_ReceivedMessageVersion >= k_ServerDeltaForwardingAndNetworkDelivery && networkManager.IsServer; var markNetworkVariableDirty = m_ReceivedMessageVersion >= k_ServerDeltaForwardingAndNetworkDelivery ? false : networkManager.IsServer; - m_UpdatedNetworkVariables = new List(); + m_UpdatedNetworkVariables = new NativeList(Allocator.Temp); if (networkBehaviour == null) { @@ -396,9 +396,9 @@ public void Handle(ref NetworkContext context) // When a server forwards delta updates to connected clients, it needs to preserve the previous value // until it is done serializing all valid NetworkVariable field deltas (relative to each client). This // is invoked after it is done forwarding the deltas. - foreach (var fieldIndex in m_UpdatedNetworkVariables) + for (int i = 0; i < m_UpdatedNetworkVariables.Length; i++) { - networkBehaviour.NetworkVariableFields[fieldIndex].PostDeltaRead(); + networkBehaviour.NetworkVariableFields[m_UpdatedNetworkVariables[i]].PostDeltaRead(); } } } diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs index b7f1320788..0dbb3b6bf6 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs @@ -83,12 +83,8 @@ public static void Handle(ref NetworkContext context, ref RpcMetadata metadata, { networkManager.Log.Exception(ex, new Context(LogLevel.Error, "Unhandled RPC exception!").AddNetworkBehaviour(networkBehaviour)); - var methodId = metadata.NetworkRpcMethodId; - networkManager.Log.Info(new Context(LogLevel.Developer, "RPC Table Contents").AddCollection(rpcsForBehaviour, entry => - { - var invokePermission = NetworkBehaviour.__rpc_permission_table[networkBehaviour.GetType()][methodId]; - return $"{entry.Key} | {entry.Value.Method.Name} | {invokePermission}"; - })); + var invokePermission = permission; + networkManager.Log.Info(new Context(LogLevel.Developer, "RPC Table Contents").AddCollection(rpcsForBehaviour, entry => $"{entry.Key} | {entry.Value.Method.Name} | {invokePermission}")); } } } diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs index 343cec9961..21df4c7e4b 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs @@ -503,9 +503,9 @@ internal void CleanupDisconnectedClients() m_DisconnectedClients.Clear(); } - public static int CreateMessageAndGetVersion() where T : INetworkMessage, new() + public static int CreateMessageAndGetVersion() where T : struct, INetworkMessage { - return new T().Version; + return default(T).Version; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -538,10 +538,10 @@ internal int GetMessageVersion(Type type, ulong clientId, bool forReceive = fals - public static void ReceiveMessage(FastBufferReader reader, ref NetworkContext context, NetworkMessageManager manager) where T : INetworkMessage, new() + public static void ReceiveMessage(FastBufferReader reader, ref NetworkContext context, NetworkMessageManager manager) where T : struct, INetworkMessage { var messageType = typeof(T); - var message = new T(); + var message = default(T); var messageVersion = 0; // Special cases because these are the messages that carry the version info - thus the version info isn't @@ -633,8 +633,9 @@ internal int SendMessage(ref TMessageType messa return largestSerializedSize; } - internal unsafe int SendPreSerializedMessage(in FastBufferWriter tmpSerializer, int maxSize, ref TMessageType message, NetworkDelivery delivery, in IReadOnlyList clientIds, int messageVersionFilter) + internal unsafe int SendPreSerializedMessage(in FastBufferWriter tmpSerializer, int maxSize, ref TMessageType message, NetworkDelivery delivery, in TClientIdListType clientIds, int messageVersionFilter) where TMessageType : INetworkMessage + where TClientIdListType : IReadOnlyList { using var headerSerializer = new FastBufferWriter(FastBufferWriter.GetWriteSize(), Allocator.Temp); diff --git a/com.unity.netcode.gameobjects/Runtime/Metrics/MetricHooks.cs b/com.unity.netcode.gameobjects/Runtime/Metrics/MetricHooks.cs index fd12bc5adc..c7badc20a0 100644 --- a/com.unity.netcode.gameobjects/Runtime/Metrics/MetricHooks.cs +++ b/com.unity.netcode.gameobjects/Runtime/Metrics/MetricHooks.cs @@ -1,10 +1,12 @@ using System; +using System.Collections.Generic; namespace Unity.Netcode { internal class MetricHooks : INetworkHooks { private readonly NetworkManager m_NetworkManager; + private readonly Dictionary m_CachedTypeNames = new(); public MetricHooks(NetworkManager networkManager) { @@ -17,12 +19,12 @@ public void OnBeforeSendMessage(ulong clientId, ref T message, NetworkDeliver public void OnAfterSendMessage(ulong clientId, ref T message, NetworkDelivery delivery, int messageSizeBytes) where T : INetworkMessage { - m_NetworkManager.NetworkMetrics.TrackNetworkMessageSent(clientId, typeof(T).Name, messageSizeBytes); + m_NetworkManager.NetworkMetrics.TrackNetworkMessageSent(clientId, GetNameForType(typeof(T)), messageSizeBytes); } public void OnBeforeReceiveMessage(ulong senderId, Type messageType, int messageSizeBytes) { - m_NetworkManager.NetworkMetrics.TrackNetworkMessageReceived(senderId, messageType.Name, messageSizeBytes); + m_NetworkManager.NetworkMetrics.TrackNetworkMessageReceived(senderId, GetNameForType(messageType), messageSizeBytes); } public void OnAfterReceiveMessage(ulong senderId, Type messageType, int messageSizeBytes) @@ -66,5 +68,22 @@ public void OnAfterHandleMessage(ref T message, ref NetworkContext context) w { // TODO: Per-message metrics recording moved here } + + /// + /// Gets the Name from a given type. + /// + private string GetNameForType(Type type) + { + if (m_CachedTypeNames.TryGetValue(type, out var cachedName)) + { + return cachedName; + } + + // type.Name does a reflection lookup that does a GC allocation + // Grab the name once and save to a cache. + var name = type.Name; + m_CachedTypeNames.Add(type, name); + return name; + } } } diff --git a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs index 9c0cb4bd83..acf139b0d1 100644 --- a/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs +++ b/com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs @@ -137,6 +137,15 @@ public override void WriteDelta(FastBufferWriter writer) } } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private T ReadValue(FastBufferReader reader) + { + // T is constrained to unmanaged, use default rather than new() to avoid an allocation. + var value = default(T); + NetworkVariableSerialization.Serializer.Read(reader, ref value); + return value; + } + /// public override void WriteField(FastBufferWriter writer) { @@ -154,9 +163,7 @@ public override void ReadField(FastBufferReader reader) reader.ReadValueSafe(out ushort count); for (int i = 0; i < count; i++) { - var value = new T(); - NetworkVariableSerialization.Serializer.Read(reader, ref value); - m_List.Add(value); + m_List.Add(ReadValue(reader)); } } @@ -178,8 +185,7 @@ public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta) { case NetworkListEvent.EventType.Add: { - var value = new T(); - NetworkVariableSerialization.Serializer.Read(reader, ref value); + var value = ReadValue(reader); m_List.Add(value); if (OnListChanged != null) @@ -188,7 +194,7 @@ public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta) { Type = eventType, Index = m_List.Length - 1, - Value = m_List[m_List.Length - 1] + Value = value }); } @@ -198,7 +204,7 @@ public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta) { Type = eventType, Index = m_List.Length - 1, - Value = m_List[m_List.Length - 1] + Value = value }); // Preserve the legacy way of handling this if (keepDirtyDelta) @@ -211,8 +217,7 @@ public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta) case NetworkListEvent.EventType.Insert: { ByteUnpacker.ReadValueBitPacked(reader, out int index); - var value = new T(); - NetworkVariableSerialization.Serializer.Read(reader, ref value); + var value = ReadValue(reader); if (index < m_List.Length) { @@ -230,7 +235,7 @@ public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta) { Type = eventType, Index = index, - Value = m_List[index] + Value = value }); } @@ -240,7 +245,7 @@ public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta) { Type = eventType, Index = index, - Value = m_List[index] + Value = value }); // Preserve the legacy way of handling this if (keepDirtyDelta) @@ -252,8 +257,7 @@ public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta) break; case NetworkListEvent.EventType.Remove: { - var value = new T(); - NetworkVariableSerialization.Serializer.Read(reader, ref value); + var value = ReadValue(reader); int index = m_List.IndexOf(value); if (index == -1) { @@ -323,8 +327,7 @@ public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta) case NetworkListEvent.EventType.Value: { ByteUnpacker.ReadValueBitPacked(reader, out int index); - var value = new T(); - NetworkVariableSerialization.Serializer.Read(reader, ref value); + var value = ReadValue(reader); if (index >= m_List.Length) { throw new Exception("Shouldn't be here, index is higher than list length"); diff --git a/com.unity.netcode.gameobjects/Runtime/Serialization/BitReader.cs b/com.unity.netcode.gameobjects/Runtime/Serialization/BitReader.cs index ab8c9bc5ce..92d1951a7a 100644 --- a/com.unity.netcode.gameobjects/Runtime/Serialization/BitReader.cs +++ b/com.unity.netcode.gameobjects/Runtime/Serialization/BitReader.cs @@ -170,7 +170,7 @@ public unsafe void ReadBit(out bool bit) [MethodImpl(MethodImplOptions.AggressiveInlining)] private unsafe void ReadPartialValue(out T value, int bytesToRead, int offsetBytes = 0) where T : unmanaged { - var val = new T(); + var val = default(T); byte* ptr = ((byte*)&val) + offsetBytes; byte* bufferPointer = m_BufferPointer + BytePosition; UnsafeUtility.MemCpy(ptr, bufferPointer, bytesToRead); diff --git a/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferReader.cs b/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferReader.cs index d132f775fd..522e9c4bad 100644 --- a/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferReader.cs +++ b/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferReader.cs @@ -707,7 +707,7 @@ public unsafe void ReadPartialValue(out T value, int bytesToRead, int offsetB } #endif - var val = new T(); + var val = default(T); byte* ptr = ((byte*)&val) + offsetBytes; byte* bufferPointer = Handle->BufferPointer + Handle->Position; UnsafeUtility.MemCpy(ptr, bufferPointer, bytesToRead); diff --git a/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageReceivingTests.cs b/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageReceivingTests.cs index 5a879f1c20..1cf88e4815 100644 --- a/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageReceivingTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageReceivingTests.cs @@ -1,9 +1,10 @@ using System; using System.Collections.Generic; using NUnit.Framework; -using NUnit.Framework.Internal; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; +using UnityEngine.TestTools.Constraints; +using Is = NUnit.Framework.Is; namespace Unity.Netcode.GameObjects.EditorTests { @@ -95,22 +96,23 @@ public void WhenHandlingAMessage_ReceiveMethodIsCalled() }; var message = GetMessage(); - var writer = new FastBufferWriter(1300, Allocator.Temp); - using (writer) - { - writer.TryBeginWrite(FastBufferWriter.GetWriteSize(message)); - writer.WriteValue(message); + using var writer = new FastBufferWriter(1300, Allocator.Temp); + writer.TryBeginWrite(FastBufferWriter.GetWriteSize(message)); + writer.WriteValue(message); - var reader = new FastBufferReader(writer, Allocator.Temp); - using (reader) - { - m_MessageManager.HandleMessage(messageHeader, reader, 0, 0, 0); - Assert.IsTrue(TestMessage.Deserialized); - Assert.IsTrue(TestMessage.Handled); - Assert.AreEqual(1, TestMessage.DeserializedValues.Count); - Assert.AreEqual(message, TestMessage.DeserializedValues[0]); - } - } + using var reader = new FastBufferReader(writer, Allocator.Temp); + m_MessageManager.HandleMessage(messageHeader, reader, 0, 0, 0); + Assert.IsTrue(TestMessage.Deserialized); + Assert.IsTrue(TestMessage.Handled); + Assert.AreEqual(1, TestMessage.DeserializedValues.Count); + Assert.AreEqual(message, TestMessage.DeserializedValues[0]); + + // Check for GC Allocations + Assert.That(() => + { + reader.Seek(0); + m_MessageManager.HandleMessage(messageHeader, reader, 0, 0, 0); + }, Is.Not.AllocatingGCMemory()); } [Test] @@ -220,44 +222,45 @@ public unsafe void WhenReceivingMultipleMessagesAndProcessingMessageQueue_Receiv var message = GetMessage(); var message2 = GetMessage(); - var writer = new FastBufferWriter(1300, Allocator.Temp); - using (writer) + using var writer = new FastBufferWriter(1300, Allocator.Temp); + writer.WriteValueSafe(batchHeader); + BytePacker.WriteValueBitPacked(writer, messageHeader.MessageType); + BytePacker.WriteValueBitPacked(writer, messageHeader.MessageSize); + writer.WriteValueSafe(message); + BytePacker.WriteValueBitPacked(writer, messageHeader.MessageType); + BytePacker.WriteValueBitPacked(writer, messageHeader.MessageSize); + writer.WriteValueSafe(message2); + + // Fill out the rest of the batch header + writer.Seek(0); + batchHeader = new NetworkBatchHeader { - writer.WriteValueSafe(batchHeader); - BytePacker.WriteValueBitPacked(writer, messageHeader.MessageType); - BytePacker.WriteValueBitPacked(writer, messageHeader.MessageSize); - writer.WriteValueSafe(message); - BytePacker.WriteValueBitPacked(writer, messageHeader.MessageType); - BytePacker.WriteValueBitPacked(writer, messageHeader.MessageSize); - writer.WriteValueSafe(message2); + Magic = NetworkBatchHeader.MagicValue, + BatchSize = writer.Length, + BatchHash = XXHash.Hash64(writer.GetUnsafePtr() + sizeof(NetworkBatchHeader), writer.Length - sizeof(NetworkBatchHeader)), + BatchCount = 2 + }; + writer.WriteValue(batchHeader); - // Fill out the rest of the batch header - writer.Seek(0); - batchHeader = new NetworkBatchHeader - { - Magic = NetworkBatchHeader.MagicValue, - BatchSize = writer.Length, - BatchHash = XXHash.Hash64(writer.GetUnsafePtr() + sizeof(NetworkBatchHeader), writer.Length - sizeof(NetworkBatchHeader)), - BatchCount = 2 - }; - writer.WriteValue(batchHeader); + var data = new ArraySegment(writer.ToArray()); + m_MessageManager.HandleIncomingData(0, data, 0); + Assert.IsFalse(TestMessage.Deserialized); + Assert.IsFalse(TestMessage.Handled); + Assert.IsEmpty(TestMessage.DeserializedValues); - var reader = new FastBufferReader(writer, Allocator.Temp); - using (reader) - { - m_MessageManager.HandleIncomingData(0, new ArraySegment(writer.ToArray()), 0); - Assert.IsFalse(TestMessage.Deserialized); - Assert.IsFalse(TestMessage.Handled); - Assert.IsEmpty(TestMessage.DeserializedValues); + m_MessageManager.ProcessIncomingMessageQueue(); + Assert.IsTrue(TestMessage.Deserialized); + Assert.IsTrue(TestMessage.Handled); + Assert.AreEqual(2, TestMessage.DeserializedValues.Count); + Assert.AreEqual(message, TestMessage.DeserializedValues[0]); + Assert.AreEqual(message2, TestMessage.DeserializedValues[1]); - m_MessageManager.ProcessIncomingMessageQueue(); - Assert.IsTrue(TestMessage.Deserialized); - Assert.IsTrue(TestMessage.Handled); - Assert.AreEqual(2, TestMessage.DeserializedValues.Count); - Assert.AreEqual(message, TestMessage.DeserializedValues[0]); - Assert.AreEqual(message2, TestMessage.DeserializedValues[1]); - } - } + // Check for GC Allocations + Assert.That(() => + { + m_MessageManager.HandleIncomingData(0, data, 0); + m_MessageManager.ProcessIncomingMessageQueue(); + }, Is.Not.AllocatingGCMemory()); } } } diff --git a/com.unity.netcode.gameobjects/Tests/Editor/Serialization/BytePackerTests.cs b/com.unity.netcode.gameobjects/Tests/Editor/Serialization/BytePackerTests.cs index 30881efff0..9189843ac3 100644 --- a/com.unity.netcode.gameobjects/Tests/Editor/Serialization/BytePackerTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Editor/Serialization/BytePackerTests.cs @@ -92,7 +92,7 @@ private unsafe void RunTypeTest(T value) where T : unmanaged using (reader) { - var outVal = new T(); + var outVal = default(T); MethodInfo method; if (value is Enum) { diff --git a/com.unity.netcode.gameobjects/Tests/Editor/Serialization/FastBufferReaderTests.cs b/com.unity.netcode.gameobjects/Tests/Editor/Serialization/FastBufferReaderTests.cs index b27eda622b..ac840639d0 100644 --- a/com.unity.netcode.gameobjects/Tests/Editor/Serialization/FastBufferReaderTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Editor/Serialization/FastBufferReaderTests.cs @@ -259,7 +259,7 @@ private void RunReadMethod(string methodName, FastBufferReader reader, out T } } } - value = new T(); + value = default; Assert.NotNull(method); @@ -766,8 +766,7 @@ public unsafe void RunFixedStringTest(T fixedStringValue, int numBytesWritten { VerifyPositionAndLength(reader, writer.Length); - var result = new T(); - reader.ReadValueSafe(out result); + reader.ReadValueSafe(out T result); Assert.AreEqual(fixedStringValue, result); VerifyCheckBytes(reader, serializedValueSize); diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/DeferredDespawningTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/DeferredDespawningTests.cs index 1902539113..dac15570f7 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/DeferredDespawningTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/DeferredDespawningTests.cs @@ -53,6 +53,7 @@ protected override void OnServerAndClientsCreated() [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator DeferredDespawning() { // Setup for test diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/NetworkClientAndPlayerObjectTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/NetworkClientAndPlayerObjectTests.cs index 929592a9b0..aabe7522c7 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/NetworkClientAndPlayerObjectTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/NetworkClientAndPlayerObjectTests.cs @@ -155,6 +155,7 @@ private bool AllNetworkClientsValidated() /// Validates the same thing when a client late joins and when a client disconnects. /// [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149595", "ValidateNetworkClients throws duplicate-key ArgumentException on CoreCLR (DAHost)")] public IEnumerator ValidateNetworkClients() { // Validate the initial clients created diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/Configuration/SinglePlayerSessions.cs b/com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/Configuration/SinglePlayerSessions.cs index 945807a06c..774debccf0 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/Configuration/SinglePlayerSessions.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/Configuration/SinglePlayerSessions.cs @@ -151,6 +151,7 @@ protected override void OnNewClientCreated(NetworkManager networkManager) } [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator SwitchTransportTest() { var authority = GetAuthorityNetworkManager(); diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/NetworkVariable/CustomSerializationDocsTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/NetworkVariable/CustomSerializationDocsTests.cs index 1e6096b187..69dfae8be8 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/NetworkVariable/CustomSerializationDocsTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/NetworkVariable/CustomSerializationDocsTests.cs @@ -173,6 +173,7 @@ private bool ValidateAllAreEqual(StringBuilder errorLog) } [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator TestHealthCode() { var authority = GetAuthorityNetworkManager(); diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Helpers/MessageCatcher.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Helpers/MessageCatcher.cs index f408532871..63955c1acc 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Helpers/MessageCatcher.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Helpers/MessageCatcher.cs @@ -25,7 +25,6 @@ private struct TriggerData public void ReleaseMessages() { - foreach (var caughtSpawn in m_CaughtMessages) { // Reader will be disposed within HandleMessage @@ -33,6 +32,13 @@ public void ReleaseMessages() } } + public void HandleCaughtMessage(int index) + { + var caughtMessage = m_CaughtMessages[index]; + // Reader will be disposed within HandleMessage + m_OwnerNetworkManager.ConnectionManager.MessageManager.HandleMessage(caughtMessage.Header, caughtMessage.Reader, caughtMessage.SenderId, caughtMessage.Timestamp, caughtMessage.SerializedHeaderSize); + } + public int CaughtMessageCount => m_CaughtMessages.Count; public void OnBeforeSendMessage(ulong clientId, ref T message, NetworkDelivery delivery) where T : INetworkMessage diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Messaging/MessageReceiveAllocationTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Messaging/MessageReceiveAllocationTests.cs new file mode 100644 index 0000000000..bcd768ac9c --- /dev/null +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Messaging/MessageReceiveAllocationTests.cs @@ -0,0 +1,106 @@ +using System.Collections; +using NUnit.Framework; +using Unity.Netcode.TestHelpers.Runtime; +using UnityEngine; +using UnityEngine.TestTools; +using UnityEngine.TestTools.Constraints; +using Is = NUnit.Framework.Is; + +namespace Unity.Netcode.RuntimeTests +{ + internal class AllocationTestBehaviour : NetworkBehaviour + { + internal int RpcReceivedCount; + + public NetworkVariable TestVariable = new(); + + [Rpc(SendTo.NotMe)] + public void NotMeRpc() + { + RpcReceivedCount++; + } + } + + [TestFixture(HostOrServer.Host)] + [TestFixture(HostOrServer.DAHost)] + internal class MessageReceiveAllocationTests : NetcodeIntegrationTest + { + protected override int NumberOfClients => 1; + + public MessageReceiveAllocationTests(HostOrServer hostOrServer) : base(hostOrServer) { } + + private GameObject m_Prefab; + + protected override void OnServerAndClientsCreated() + { + m_Prefab = CreateNetworkObjectPrefab(nameof(AllocationTestBehaviour)); + m_Prefab.AddComponent(); + base.OnServerAndClientsCreated(); + } + + [UnityTest] + public IEnumerator NoAllocationsOnMessageReceive() + { + var authority = GetAuthorityNetworkManager(); + var nonAuthority = GetNonAuthorityNetworkManager(); + + var authorityInstance = SpawnObject(m_Prefab, authority); + var authorityComponent = authorityInstance.GetComponent(); + yield return WaitForSpawnedOnAllOrTimeOut(authorityInstance); + AssertOnTimeout("Timed out waiting for objects to spawn"); + + var nonAuthorityComponent = nonAuthority.SpawnManager.SpawnedObjects[authorityComponent.NetworkObjectId].GetComponent(); + + /* + * RpcMessage + */ + var rpcCatcher = new MessageCatcher(nonAuthority); + nonAuthority.ConnectionManager.MessageManager.Hook(rpcCatcher); + + // Send the same message twice: the first is replayed as a warm-up. + // The second will follow the identical code path and is checked for allocations. + authorityComponent.NotMeRpc(); + authorityComponent.NotMeRpc(); + yield return WaitForConditionOrTimeOut(() => rpcCatcher.CaughtMessageCount == 2); + AssertOnTimeout($"Timed out waiting to catch all expected {nameof(RpcMessage)} messages. Expected: 2, Actual: {rpcCatcher.CaughtMessageCount}"); + + // Unhook first so the replayed messages are handled instead of being caught again + nonAuthority.ConnectionManager.MessageManager.Unhook(rpcCatcher); + + rpcCatcher.HandleCaughtMessage(0); + Assert.AreEqual(1, nonAuthorityComponent.RpcReceivedCount); + + Assert.That(() => + { + rpcCatcher.HandleCaughtMessage(1); + }, Is.Not.AllocatingGCMemory()); + Assert.AreEqual(2, nonAuthorityComponent.RpcReceivedCount); + + /* + * NetworkVariableDeltaMessage + */ + var deltaCatcher = new MessageCatcher(nonAuthority); + nonAuthority.ConnectionManager.MessageManager.Hook(deltaCatcher); + + authorityComponent.TestVariable.Value = 1; + // Wait for the first change to be received client-side before sending the second change + yield return WaitForConditionOrTimeOut(() => deltaCatcher.CaughtMessageCount == 1); + authorityComponent.TestVariable.Value = 2; + yield return WaitForConditionOrTimeOut(() => deltaCatcher.CaughtMessageCount == 2); + AssertOnTimeout($"Timed out waiting to catch all expected {nameof(NetworkVariableDeltaMessage)} messages. Expected: 2, Actual: {deltaCatcher.CaughtMessageCount}"); + + // Unhook first so the replayed messages are handled instead of being caught again + nonAuthority.ConnectionManager.MessageManager.Unhook(deltaCatcher); + + deltaCatcher.HandleCaughtMessage(0); + Assert.AreEqual(1, nonAuthorityComponent.TestVariable.Value); + + Assert.That(() => + { + deltaCatcher.HandleCaughtMessage(1); + }, Is.Not.AllocatingGCMemory()); + Assert.AreEqual(2, nonAuthorityComponent.TestVariable.Value); + } + + } +} diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Messaging/MessageReceiveAllocationTests.cs.meta b/com.unity.netcode.gameobjects/Tests/Runtime/Messaging/MessageReceiveAllocationTests.cs.meta new file mode 100644 index 0000000000..88be098d8d --- /dev/null +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Messaging/MessageReceiveAllocationTests.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 52d657f70a8454deaa08d1de60e0fee1 \ No newline at end of file diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkObject/NetworkObjectSynchronizationTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkObject/NetworkObjectSynchronizationTests.cs index 7535e4ffce..b943be4883 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkObject/NetworkObjectSynchronizationTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkObject/NetworkObjectSynchronizationTests.cs @@ -94,6 +94,7 @@ protected override void OnNewClientCreated(NetworkManager networkManager) } [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public IEnumerator NetworkObjectDeserializationFailure() { m_CurrentLogLevel = LogLevel.Nothing; @@ -277,6 +278,7 @@ private void ValidateNetworkBehaviourWithNetworkVariables(NetworkObject authorit /// will still be initialized properly /// [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public IEnumerator NetworkBehaviourSynchronization() { var authority = GetAuthorityNetworkManager(); @@ -319,6 +321,7 @@ public IEnumerator NetworkBehaviourSynchronization() /// A basic validation for the NetworkBehaviour.OnSynchronize method /// [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public IEnumerator NetworkBehaviourOnSynchronize() { var authority = GetAuthorityNetworkManager(); diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkListTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkListTests.cs index daceeee8b9..f0558be4b3 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkListTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkListTests.cs @@ -248,6 +248,7 @@ void TestForceUpdateCallback(NetworkListEvent _) // don't extend this please [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator LegacyPredicateTesting() { var authority = GetAuthorityNetworkManager(); diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableAnticipationTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableAnticipationTests.cs index 09d37cb64a..b5b89d02f1 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableAnticipationTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableAnticipationTests.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using Unity.Netcode.TestHelpers.Runtime; using UnityEngine; +using UnityEngine.TestTools; namespace Unity.Netcode.RuntimeTests { @@ -58,6 +59,7 @@ public void SetReanticipateValueRpc(float f) } } + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] internal class NetworkVariableAnticipationTests : NetcodeIntegrationTest { protected override int NumberOfClients => 2; diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableCollectionsChangingTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableCollectionsChangingTests.cs index ce0b7d378c..1b61c05bca 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableCollectionsChangingTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableCollectionsChangingTests.cs @@ -17,6 +17,7 @@ namespace Unity.Netcode.RuntimeTests [TestFixture(HostOrServer.Host, CollectionTypes.Dictionary)] [TestFixture(HostOrServer.Server, CollectionTypes.List)] [TestFixture(HostOrServer.Server, CollectionTypes.Dictionary)] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] internal class NetworkVariableCollectionsChangingTests : NetcodeIntegrationTest { protected override int NumberOfClients => 2; diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableCollectionsTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableCollectionsTests.cs index 69e8727f27..c4cdf5e3e6 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableCollectionsTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableCollectionsTests.cs @@ -22,6 +22,7 @@ namespace Unity.Netcode.RuntimeTests /// [TestFixture(HostOrServer.Host)] [TestFixture(HostOrServer.Server)] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] internal class NetworkVariableCollectionsTests : NetcodeIntegrationTest { protected override int NumberOfClients => 2; diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableGeneralTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableGeneralTests.cs index b0f3e8be56..4623351b7b 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableGeneralTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableGeneralTests.cs @@ -140,6 +140,7 @@ private bool ChangedValueMatches(StringBuilder errorLog) /// instances invoke . /// [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator ApplyValueDuringSpawnSequence() { var authority = GetAuthorityNetworkManager(); diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariablePermissionTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariablePermissionTests.cs index 73481fd02c..f1c882685e 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariablePermissionTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariablePermissionTests.cs @@ -11,6 +11,7 @@ namespace Unity.Netcode.RuntimeTests { [TestFixtureSource(nameof(TestDataSource))] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] internal class NetworkVariablePermissionTests : NetcodeIntegrationTest { public static IEnumerable TestDataSource() diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTests.cs index 85a72d9f19..33178e9d27 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTests.cs @@ -349,6 +349,7 @@ private void InitializeServerAndClients(HostOrServer useHost) /// Runs generalized tests on all predefined NetworkVariable types /// [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void AllNetworkVariableTypes([Values] HostOrServer useHost) { var prefabToSpawn = CreateNetworkObjectPrefab("NetVarTest"); @@ -391,6 +392,7 @@ public void AllNetworkVariableTypes([Values] HostOrServer useHost) } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void ClientWritePermissionTest([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -405,6 +407,7 @@ public void ClientWritePermissionTest([Values] HostOrServer useHost) /// Runs tests that network variables sync on client whatever the local value of . /// [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void NetworkVariableSync_WithDifferentTimeScale([Values] HostOrServer useHost, [Values(0.0f, 1.0f, 2.0f)] float timeScale) { Time.timeScale = timeScale; @@ -419,6 +422,7 @@ public void NetworkVariableSync_WithDifferentTimeScale([Values] HostOrServer use } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void FixedString32Test([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -430,6 +434,7 @@ public void FixedString32Test([Values] HostOrServer useHost) } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestNetworkVariableClass([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -449,6 +454,7 @@ bool VerifyClass() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestNetworkVariableTemplateClass([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -467,6 +473,7 @@ bool VerifyClass() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestNetworkVariableStruct([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -485,6 +492,7 @@ bool VerifyStructure() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestNetworkVariableTemplateStruct([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -503,6 +511,7 @@ bool VerifyStructure() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestNetworkVariableTemplateBehaviourClass([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -525,6 +534,7 @@ bool VerifyClass() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestNetworkVariableTemplateBehaviourClassNotReferencedElsewhere([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -543,6 +553,7 @@ bool VerifyClass() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestNetworkVariableTemplateBehaviourStruct([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -561,6 +572,7 @@ bool VerifyClass() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestNetworkVariableEnum([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -578,6 +590,7 @@ bool VerifyStructure() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestINetworkSerializableClassCallsNetworkSerialize([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -596,6 +609,7 @@ public void TestINetworkSerializableClassCallsNetworkSerialize([Values] HostOrSe } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestINetworkSerializableStructCallsNetworkSerialize([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -610,6 +624,7 @@ public void TestINetworkSerializableStructCallsNetworkSerialize([Values] HostOrS } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void TestCustomGenericSerialization() { // Just verifies that the ILPP codegen initialized these values for this type. @@ -663,6 +678,7 @@ public void TestUnsupportedManagedTypesThrowExceptions() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void TestUnsupportedManagedTypesWithUserSerializationDoNotThrowExceptions() { var variable = new NetworkVariable(); @@ -718,6 +734,7 @@ public void TestUnsupportedUnmanagedTypesThrowExceptions() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void TestTypesReferencedInSubclassSerializeSuccessfully() { var variable = new NetworkVariableSubclass>(); @@ -733,6 +750,7 @@ public void TestTypesReferencedInSubclassSerializeSuccessfully() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void TestUnsupportedUnmanagedTypesWithUserSerializationDoNotThrowExceptions() { var variable = new NetworkVariable(); @@ -806,6 +824,7 @@ public void WhenCreatingAnArrayOfNetVars_InitializingVariablesDoesNotThrowAnExce } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public void TestNetworkVariableChangeAndReturnInSameFrame([Values] HostOrServer useHost) { InitializeServerAndClients(useHost); @@ -1363,6 +1382,7 @@ private void TestValueTypeNativeHashMap(NativeHashMap te } #endif [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void WhenSerializingAndDeserializingValueTypeNetworkVariables_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), @@ -1530,6 +1550,7 @@ public void WhenSerializingAndDeserializingValueTypeNetworkVariables_ValuesAreSe } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void WhenSerializingAndDeserializingValueTypeNativeArrayNetworkVariables_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), @@ -1780,7 +1801,7 @@ public void WhenSerializingAndDeserializingValueTypeNativeArrayNetworkVariables_ public unsafe T RandGenBytes(System.Random rand) where T : unmanaged { - var t = new T(); + var t = default(T); T* tPtr = &t; var s = new Span(tPtr, sizeof(T)); rand.NextBytes(s); @@ -1873,6 +1894,7 @@ public string ArrayStr(NativeArray arr) where T : unmanaged [Test] [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Ignored test tracked in MTT-11343 [Repeat(5)] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void WhenSerializingAndDeserializingVeryLargeValueTypeNativeArrayNetworkVariables_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), @@ -2335,6 +2357,7 @@ public string DictionaryStr(Dictionary list) [Test] [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Ignored test tracked in MTT-11343 [Repeat(5)] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void WhenSerializingAndDeserializingVeryLargeListNetworkVariables_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), @@ -2530,6 +2553,7 @@ public void WhenSerializingAndDeserializingVeryLargeListNetworkVariables_ValuesA [Test] [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Ignored test tracked in MTT-11343 [Repeat(5)] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void WhenSerializingAndDeserializingVeryLargeHashSetNetworkVariables_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), @@ -2694,6 +2718,7 @@ public void WhenSerializingAndDeserializingVeryLargeHashSetNetworkVariables_Valu [Test] [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Ignored test tracked in MTT-11343 [Repeat(5)] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void WhenSerializingAndDeserializingVeryLargeDictionaryNetworkVariables_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(ulong), typeof(Vector2), typeof(HashMapKeyClass))] Type keyType, @@ -4810,6 +4835,7 @@ public void WhenSerializingAndDeserializingVeryLargeValueTypeNativeHashMapNetwor #endif [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void TestManagedINetworkSerializableNetworkVariablesDeserializeInPlace() { var variable = new NetworkVariable @@ -4846,6 +4872,7 @@ public void TestManagedINetworkSerializableNetworkVariablesDeserializeInPlace() } [Test] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public void TestUnmnagedINetworkSerializableNetworkVariablesDeserializeInPlace() { var variable = new NetworkVariable diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTraitsTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTraitsTests.cs index 97d3e7a499..45a66c6670 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTraitsTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTraitsTests.cs @@ -15,6 +15,7 @@ internal class NetworkVariableTraitsComponent : NetworkBehaviour [TestFixture(HostOrServer.Host)] [TestFixture(HostOrServer.DAHost)] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] internal class NetworkVariableTraitsTests : NetcodeIntegrationTest { protected override int NumberOfClients => 3; diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableUserSerializableTypesTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableUserSerializableTypesTests.cs index c261bdf032..cf9021f463 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableUserSerializableTypesTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableUserSerializableTypesTests.cs @@ -142,6 +142,7 @@ private bool CheckForClientInstance() where T : WorkingUserNetworkVariableCom } [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator WhenUsingAUserSerializableNetworkVariableWithUserSerialization_ReplicationWorks() { UserNetworkVariableSerialization.WriteValue = (FastBufferWriter writer, in MyTypeOne value) => @@ -182,6 +183,7 @@ public IEnumerator WhenUsingAUserSerializableNetworkVariableWithUserSerializatio } [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator WhenUsingAUserSerializableNetworkVariableWithUserSerializationViaExtensionMethod_ReplicationWorks() { UserNetworkVariableSerialization.WriteValue = NetworkVariableUserSerializableTypesTestsExtensionMethods.WriteValueSafe; diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/OwnerPermissionTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/OwnerPermissionTests.cs index cee5a131c6..1879da0174 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/OwnerPermissionTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/OwnerPermissionTests.cs @@ -98,6 +98,7 @@ protected override void OnServerAndClientsCreated() } [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149597", "Unexpected owner write-permission error logged on CoreCLR")] public IEnumerator OwnerPermissionTest() { // create 3 objects diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/PeerDisconnectCallbackTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/PeerDisconnectCallbackTests.cs index a8d0c6a4ef..d273cf9f1f 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/PeerDisconnectCallbackTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/PeerDisconnectCallbackTests.cs @@ -104,6 +104,7 @@ private void ClientToDisconnect_OnClientStopped(bool wasHost) } [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149591", "NGO multi-instance test sessions fail to start/connect or time out on CoreCLR")] public IEnumerator TestPeerDisconnectCallback([Values] ClientDisconnectType clientDisconnectType, [Values(1ul, 2ul, 3ul)] ulong disconnectedClient) { m_TargetClientShutdown = false; diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcInvocationTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcInvocationTests.cs index 52faa09867..83cdb828bf 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcInvocationTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcInvocationTests.cs @@ -8,6 +8,8 @@ using Unity.Netcode.TestHelpers.Runtime; using UnityEngine; using UnityEngine.TestTools; +using UnityEngine.TestTools.Constraints; +using Is = NUnit.Framework.Is; namespace Unity.Netcode.RuntimeTests { @@ -335,6 +337,12 @@ public IEnumerator RpcInvocationOrderTests() Assert.IsTrue(ValidateInvocationOrder(errorLog), $"[Has nested][nonAuthority][{testType}] Rpcs were invoked in an incorrect order\n {errorLog}"); errorLog.Clear(); } + + // Safety check for GC allocations + Assert.That(() => + { + nonAuthorityInstance.EveryoneInvokePermissionRpc(); + }, Is.Not.AllocatingGCMemory()); } private void ResetAllExpectedInvocations() diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcManyClientsTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcManyClientsTests.cs index 62fb94bbe5..99f88ecf85 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcManyClientsTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcManyClientsTests.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using Unity.Netcode.TestHelpers.Runtime; using UnityEngine; +using UnityEngine.TestTools.Constraints; namespace Unity.Netcode.RuntimeTests { @@ -150,6 +151,12 @@ public void RpcManyClientsTest() var possibility1 = new List { m_ClientNetworkManagers[1].LocalClientId, m_ClientNetworkManagers[2].LocalClientId }; var possibility2 = new List { m_ClientNetworkManagers[2].LocalClientId, m_ClientNetworkManagers[1].LocalClientId }; Debug.Assert(Enumerable.SequenceEqual(rpcManyClientsObject.ReceivedFrom, possibility1) || Enumerable.SequenceEqual(rpcManyClientsObject.ReceivedFrom, possibility2)); + + // Safety check for GC allocations + Assert.That(() => + { + rpcManyClientsObject.WithParamsClientRpc(param); + }, NUnit.Framework.Is.Not.AllocatingGCMemory()); } } } diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcTests.cs index 23c546e4fa..0ec70b0e21 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcTests.cs @@ -91,6 +91,7 @@ protected override void OnCreatePlayerPrefab() } [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator TestRpcs() { // This is the *SERVER VERSION* of the *CLIENT PLAYER* RpcTestNB component diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcTypeSerializationTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcTypeSerializationTests.cs index ca1ce942ae..f26baeb5d1 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcTypeSerializationTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcTypeSerializationTests.cs @@ -1125,6 +1125,7 @@ public IEnumerator TestValueTypeNativeList(NativeList firstTest, NativeLis #endif [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator WhenSendingAValueTypeOverAnRpc_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), @@ -1539,6 +1540,7 @@ public IEnumerator WhenSendingAnArrayOfValueTypesOverAnRpc_ValuesAreSerializedCo } [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator WhenSendingANativeArrayOfValueTypesOverAnRpc_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Serialization/NetworkBehaviourReferenceTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Serialization/NetworkBehaviourReferenceTests.cs index 20e27d6492..fcb3fa5fc7 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Serialization/NetworkBehaviourReferenceTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Serialization/NetworkBehaviourReferenceTests.cs @@ -22,6 +22,7 @@ public NetworkBehaviourReferenceTests(HostOrServer hostOrServer) : base(hostOrSe #region Tests using non-null NetworkBehaviours and RPCs [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator TestRpc() { yield return SpawnTestPrefabInstance(); @@ -36,6 +37,7 @@ public IEnumerator TestRpc() [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator TestRpcImplicitNetworkBehaviour() { yield return SpawnTestPrefabInstance(); diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Transports/SinglePlayerTransportTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Transports/SinglePlayerTransportTests.cs index 4f198c73d2..33c801cc12 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Transports/SinglePlayerTransportTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Transports/SinglePlayerTransportTests.cs @@ -176,6 +176,7 @@ protected override bool CanStartServerAndClients() } [UnityTest] + [UnityCoreClrExplicitDisabled("https://jira.unity3d.com/browse/UUM-149592", "NGO NetworkVariable serialization codegen not generated for some types on CoreCLR (falls back to FallbackSerializer)")] public IEnumerator StartSinglePlayerAndSpawn() { m_CanStartHost = true; diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef b/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef index 86b6bae95f..d44f54d3e8 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef @@ -54,6 +54,10 @@ "name": "com.unity.netcode", "expression": "1.10.1", "define": "UNIFIED_NETCODE" + }, + "name": "com.unity.test-framework", + "expression": "1.7.0", + "define": "UNITY_TEST_FRAMEWORK_1_7_OR_NEWER" } ], "noEngineReferences": false diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/UnityCoreClrExplicitDisabledAttributeShim.cs b/com.unity.netcode.gameobjects/Tests/Runtime/UnityCoreClrExplicitDisabledAttributeShim.cs new file mode 100644 index 0000000000..07baa43dc0 --- /dev/null +++ b/com.unity.netcode.gameobjects/Tests/Runtime/UnityCoreClrExplicitDisabledAttributeShim.cs @@ -0,0 +1,14 @@ +#if !UNITY_TEST_FRAMEWORK_1_7_OR_NEWER +using System; + +namespace UnityEngine.TestTools +{ + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + internal sealed class UnityCoreClrExplicitDisabledAttribute : Attribute + { + public UnityCoreClrExplicitDisabledAttribute(string jiraIssue, string reason = null) + { + } + } +} +#endif diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/UnityCoreClrExplicitDisabledAttributeShim.cs.meta b/com.unity.netcode.gameobjects/Tests/Runtime/UnityCoreClrExplicitDisabledAttributeShim.cs.meta new file mode 100644 index 0000000000..d3dc8d26c9 --- /dev/null +++ b/com.unity.netcode.gameobjects/Tests/Runtime/UnityCoreClrExplicitDisabledAttributeShim.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b7f17392536340a8b607dd678b2ecd76 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: