Skip to content

Commit

Permalink
fix: Update to Unity 2022.3.55f1 (#1957)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes authored Jan 13, 2025
1 parent 4bc67a8 commit 54613dd
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ jobs:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [smoke-test-build]
name: ${{ matrix.unity-version }} ${{ matrix.platform }} Compile Smoke Test
runs-on: ${{ matrix.platform == 'iOS' && 'macos' || 'ubuntu' }}-latest
runs-on: ${{ matrix.platform == 'iOS' && 'macos-latest' || 'ubuntu-latest-4-cores' }}
strategy:
fail-fast: false
matrix:
Expand All @@ -463,7 +463,7 @@ jobs:
- unity-version: "2019"
ndk: "r19"
- unity-version: "2022"
ndk: "r21d"
ndk: "r23b"
- unity-version: "6000"
ndk: "r23b"

Expand Down
2 changes: 1 addition & 1 deletion scripts/ci-env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ switch ($name) {
return "2021.3.45f1"
}
"unity2022" {
return "2022.3.42f1"
return "2022.3.55f1"
}
"unity2023" {
return "2023.2.20f1"
Expand Down
7 changes: 7 additions & 0 deletions test/Scripts.Integration.Test/Editor/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ public static void BuildIl2CPPPlayer(BuildTarget target, BuildTargetGroup group,
EditorUserBuildSettings.il2CppCodeGeneration = UnityEditor.Build.Il2CppCodeGeneration.OptimizeSize;
#endif

// This is a workaround for build issues with Unity 2022.3. and newer.
// https://discussions.unity.com/t/gradle-build-issues-for-android-api-sdk-35-in-unity-2022-3lts/1502187/10
#if UNITY_2022_3_OR_NEWER
Debug.Log("Builder: Setting Android target API level to 33");
PlayerSettings.Android.targetSdkVersion = AndroidSdkVersions.AndroidApiLevel33;
#endif

Debug.Log("Builder: Updating BuildPlayerOptions");
var buildPlayerOptions = new BuildPlayerOptions
{
Expand Down
24 changes: 24 additions & 0 deletions test/Scripts.Integration.Test/modify-gradle-project.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,30 @@ If ([int]$UnityVersion -ge 2021)
}
}

# This is a temporary workaround for build issues with Unity 2022.3. and newer. Unity writes an absolute path to the aapt2 in the gradle.properties file.
# This path is not available on the CI runners, so we're replacing it with the one available on the CI runners.
# https://discussions.unity.com/t/gradle-build-issues-for-android-api-sdk-35-in-unity-2022-3lts/1502187/10
If ([int]$UnityVersion -eq 2022)
{
Write-Output "Updating aapt2 path."

$gradlePropertiesFile = Join-Path -Path $workingDirectory -ChildPath "gradle.properties"
$fileContent = Get-Content -Path $gradlePropertiesFile

$aapt2Path = "$androidSdkRoot/build-tools/34.0.0/aapt2"
if (Test-Path $aapt2Path)
{
Write-Output "Setting the aapt2 path to: $aapt2Path"

$updatedContent = $fileContent -replace '/opt/unity/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/build-tools/34.0.0/aapt2', $aapt2Path
$updatedContent | Set-Content -Path $gradlePropertiesFile
}
else
{
Write-Output "aapt2 not found at: $aapt2Path"
}
}

# Starting with Unity 6 the paths to SDK, NDK, and JDK are written to the `gradle.properties`
# We're removing it to cause it to fall back to the local.properties
If ([int]$UnityVersion -ge 6000)
Expand Down

0 comments on commit 54613dd

Please sign in to comment.