-
Notifications
You must be signed in to change notification settings - Fork 4
Unity 6 support #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Unity 6 support #194
Conversation
Update CTExample Unity Editor version to 6000.0.49f1
Update Android plugin dependencies
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) ✅ code/snyk check is complete. No issues have been found. (View Details) |
WalkthroughThis update modernizes Android and Unity build configurations by upgrading Gradle plugin and dependency versions, refactoring build script syntax to align with newer Gradle conventions, and updating Unity package dependencies. Additionally, it removes a deprecated method from the CleverTap Unity plugin and increases minimum SDK requirements. Changes
Sequence Diagram(s)sequenceDiagram
participant UnityProject
participant GradleBuildScripts
participant AndroidBuildSystem
participant CleverTapUnityPlugin
UnityProject->>GradleBuildScripts: Initiate build with updated configuration
GradleBuildScripts->>AndroidBuildSystem: Apply new plugin versions, dependencies, NDK/SDK settings
AndroidBuildSystem->>CleverTapUnityPlugin: Compile plugin with updated dependencies
CleverTapUnityPlugin--x AndroidBuildSystem: setPushToken method no longer available
AndroidBuildSystem->>UnityProject: Build output with modernized settings and dependencies
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
🔭 Outside diff range comments (1)
CTExample/Assets/Plugins/Android/launcherTemplate.gradle (1)
17-28
:compileSdk
/minSdk
/targetSdk
DSL compatibilitySame concern as in the wrapper build: AGP 4/6 (Unity 2021/2022) require the
…Version
suffixes.
🧹 Nitpick comments (6)
CleverTap/Plugins/Android/clevertap-android-wrapper.androidlib/build.gradle (2)
9-11
: Typo in variable name
mindSdkVersionVal
→minSdkVersionVal
for clarity and consistency.- mindSdkVersionVal = 21 + minSdkVersionVal = 21
51-54
: Lock Firebase via BoM to avoid transitive mismatchPinning
firebase-messaging:24.0.0
directly can clash with other Firebase libs that Unity (or downstream apps) include. Use the Firebase Bill of Materials instead:- implementation 'com.google.firebase:firebase-messaging:24.0.0' + implementation platform('com.google.firebase:firebase-bom:33.0.0') + implementation 'com.google.firebase:firebase-messaging'CTExample/Assets/Plugins/Android/mainTemplate.gradle (2)
25-27
: Stale commented-out Media3 placeholdersThe Media3 dependencies have been bumped to
1.4.0
but remain commented out.
If they are intentionally disabled, remove the lines to avoid confusion; if they are optional placeholders, add a comment clarifying the flag that enables them.
56-63
: Renamed blocks – ensure the Unity Gradle patcher is in sync
lintOptions
→lint
andaaptOptions
→androidResources
are correct for modern AGP, but Unity’s built-in Gradle file patcher (Unity 2022 and earlier) still looks for the old identifiers when merging user templates.If this SDK must stay backward-compatible with Unity 2022/2023 LTS, keep the old blocks or add both variants conditionally.
CTExample/Packages/packages-lock.json (2)
185-199
: New builtin packages – check stripping rules
com.unity.multiplayer.center
,com.unity.nuget.mono-cecil
, and new core modules inflate the build size if they end up inPlayer
.
Verify:
- They are marked as Editor only where applicable.
PlayerSettings.stripEngineCode
& managed stripping levels still exclude them.
200-218
: Test Framework 1.5.1 is preview
com.unity.test-framework
1.5.x is in preview; Unity 6 may ship 1.4.x as verified.
If the package is only for CI play-mode tests, consider locking to the latest verified version to avoid runtime regressions when the preview API changes.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
CTExample/Assets/Plugins/Android/baseProjectTemplate.gradle
(1 hunks)CTExample/Assets/Plugins/Android/launcherTemplate.gradle
(4 hunks)CTExample/Assets/Plugins/Android/mainTemplate.gradle
(3 hunks)CTExample/Packages/manifest.json
(1 hunks)CTExample/Packages/packages-lock.json
(11 hunks)CTExample/ProjectSettings/ProjectVersion.txt
(1 hunks)CleverTap/Plugins/Android/clevertap-android-wrapper.androidlib/build.gradle
(2 hunks)CleverTap/Plugins/Android/clevertap-android-wrapper.androidlib/src/main/java/com/clevertap/unity/CleverTapUnityPlugin.java
(0 hunks)
💤 Files with no reviewable changes (1)
- CleverTap/Plugins/Android/clevertap-android-wrapper.androidlib/src/main/java/com/clevertap/unity/CleverTapUnityPlugin.java
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: nzagorchev
PR: CleverTap/clevertap-unity-sdk#178
File: CTExample/Assets/AppInbox/Scripts/AppInbox.cs:24-31
Timestamp: 2025-04-24T15:10:39.004Z
Learning: The OnInboxMessageUpdate callback in the CleverTap Unity SDK is triggered specifically when new inbox messages are added, and should refresh the internal message lists to avoid stale data.
Learnt from: nzagorchev
PR: CleverTap/clevertap-unity-sdk#192
File: CTExample/Assets/Editor/IOSPushNotificationsPostBuildProcessor.cs:147-164
Timestamp: 2025-06-20T15:56:59.454Z
Learning: In CTExample/Assets/Editor/IOSPushNotificationsPostBuildProcessor.cs, the GetCleverTapIOSSDKVersion method needs to handle multiple CocoaPods dependency formats including simple versions ('7.1.1'), local paths (:path => "../clevertap-ios-sdk"), and git repositories (:git => 'url', :branch => 'develop'). The method should extract the entire dependency specification after the pod name, not just assume a simple version format.
CleverTap/Plugins/Android/clevertap-android-wrapper.androidlib/build.gradle (1)
Learnt from: nzagorchev
PR: CleverTap/clevertap-unity-sdk#192
File: CTExample/Assets/Editor/IOSPushNotificationsPostBuildProcessor.cs:147-164
Timestamp: 2025-06-20T15:56:59.454Z
Learning: In CTExample/Assets/Editor/IOSPushNotificationsPostBuildProcessor.cs, the GetCleverTapIOSSDKVersion method needs to handle multiple CocoaPods dependency formats including simple versions ('7.1.1'), local paths (:path => "../clevertap-ios-sdk"), and git repositories (:git => 'url', :branch => 'develop'). The method should extract the entire dependency specification after the pod name, not just assume a simple version format.
CTExample/Packages/manifest.json (1)
Learnt from: nzagorchev
PR: CleverTap/clevertap-unity-sdk#192
File: CTExample/Assets/Editor/IOSPushNotificationsPostBuildProcessor.cs:147-164
Timestamp: 2025-06-20T15:56:59.454Z
Learning: In CTExample/Assets/Editor/IOSPushNotificationsPostBuildProcessor.cs, the GetCleverTapIOSSDKVersion method needs to handle multiple CocoaPods dependency formats including simple versions ('7.1.1'), local paths (:path => "../clevertap-ios-sdk"), and git repositories (:git => 'url', :branch => 'develop'). The method should extract the entire dependency specification after the pod name, not just assume a simple version format.
CTExample/Assets/Plugins/Android/mainTemplate.gradle (1)
Learnt from: nzagorchev
PR: CleverTap/clevertap-unity-sdk#192
File: CTExample/Assets/Editor/IOSPushNotificationsPostBuildProcessor.cs:147-164
Timestamp: 2025-06-20T15:56:59.454Z
Learning: In CTExample/Assets/Editor/IOSPushNotificationsPostBuildProcessor.cs, the GetCleverTapIOSSDKVersion method needs to handle multiple CocoaPods dependency formats including simple versions ('7.1.1'), local paths (:path => "../clevertap-ios-sdk"), and git repositories (:git => 'url', :branch => 'develop'). The method should extract the entire dependency specification after the pod name, not just assume a simple version format.
🔇 Additional comments (10)
CTExample/ProjectSettings/ProjectVersion.txt (1)
1-2
: Confirm Unity 6 version string accuracyThe editor version string
6000.0.49f1
deviates from Unity’s usual6.0.x
(or202X.x
) format. If this is an internal preview build, CI/cloud-build images and external contributors may not recognise it.Please verify the exact version/branch name Unity expects and ensure build agents have the corresponding editor installed.
CTExample/Assets/Plugins/Android/baseProjectTemplate.gradle (1)
6-7
: Double-check AGP 8.7.2 compatibility with Unity-bundled GradleAGP 8.7.2 requires Gradle 8.7+. Unity 6 preview builds currently ship with Gradle 8.4 (subject to change). A mismatch will cause “Plugin requires minimum Gradle X” errors during Android export.
Run a local export or query
EditorPrefs.GetString("AndroidGradleToolsVersion")
to confirm the bundled Gradle version, or document the need for a custom Gradle path in the README.CTExample/Packages/manifest.json (1)
4-16
: Validate new/updated Unity packagesSeveral packages (
com.unity.ugui
2.x,com.unity.multiplayer.center
1.0.0,com.unity.modules.accessibility
1.0.0) target Unity 6 preview only. Attempting to open the project in 2022/2023 LTS will now fail.Confirm the minimum editor version in
projectSettings.asset
and update the README/CI matrix accordingly.CTExample/Assets/Plugins/Android/launcherTemplate.gradle (2)
13-14
:ndkVersion
placeholder requires Unity 2022.3+Older LTS versions ignore this key and fail the merge. Consider the same conditional pattern used for
namespace
or document the minimum required Unity version.
30-31
:debugSymbolLevel
only available in AGP 8+Unity’s default exporter for older versions will choke on this directive.
CTExample/Assets/Plugins/Android/mainTemplate.gradle (3)
8-12
: Upgraded AndroidX & Material versions are still alpha – double-check stability
appcompat:1.7.0
,recyclerview:1.3.2
, andmaterial:1.12.0
are, at the time of writing, preview / alpha releases that requirecompileSdk 34+
and AGP 8.x.
If any downstream user stays on an older tool-chain (e.g., Unity 2022 + AGP 7.3), their Gradle resolution will break.Consider pinning to the latest stable tags (
1.6.1
,1.3.1
,1.11.0
) or documenting the new minimum Android build requirements in the README/UPM meta.
31-37
:ndkVersion
&compileSdk
placeholders require AGP 8.1+
ndkVersion
at module level and the newcompileSdk
DSL syntax are only recognised by Android Gradle Plugin 8.1+.
Make surebaseProjectTemplate.gradle
setscom.android.tools.build:gradle:8.1.+
or later; otherwise Gradle will throw “unknown property”.
2-2
: We still haven’t located that helper script. Let’s search more broadly:#!/bin/bash # Search for any file named keepUnitySymbols.gradle (case‐insensitive) find . -type f -iname 'keepUnitySymbols.gradle'CTExample/Packages/packages-lock.json (2)
10-17
: Mixedcom.unity.2d.common
versions (9.0.7
vs9.0.4
)
2d.animation
now depends on9.0.7
, while2d.psdimporter
pins9.0.4
.
Unity Package Manager will resolve to one version, but silent downgrades can occur. Align the dependencies to the same minor to avoid editor package re-import loops.
102-109
: Burst version skewRoot dependency is
1.8.21
, yet several sub-packages still require1.8.17
/1.8.4
.
Unity usually upgrades to the highest, but make sure 1.8.21 is compatible with the Collections 2.5.1 and Test-Framework 1.5.x bundles, otherwise IL2CPP builds may fail.
minSdk mindSdkVersionVal | ||
targetSdk targetSdkVersionVal | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
minSdk
/targetSdk
keys also need backward-compat handling
Same issue as above; AGP <7 only accepts minSdkVersion
/targetSdkVersion
.
🤖 Prompt for AI Agents
In CleverTap/Plugins/Android/clevertap-android-wrapper.androidlib/build.gradle
around lines 25 to 27, the keys minSdk and targetSdk are used but older Android
Gradle Plugin versions (<7) require minSdkVersion and targetSdkVersion instead.
Update the build.gradle to conditionally use minSdkVersion/targetSdkVersion for
AGP versions below 7 and minSdk/targetSdk for AGP 7 and above to ensure backward
compatibility.
// Checking if namespace exists is needed for 2021.3 (AGP 4.0.1) | ||
// When 2021.3 is dropped, remove this check | ||
if (project.android.hasProperty("namespace")) { | ||
namespace "com.clevertap.unity" | ||
} | ||
compileSdk compileSdkVersionVal | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
compileSdk
DSL may break Unity 2021.3 builds
Unity 2021.3 (AGP 4.0.1) doesn’t recognise the compileSdk
property. Although you guard the namespace
block, compileSdk
will still be parsed and fail.
- compileSdk compileSdkVersionVal
+ // AGP 7+ : compileSdk = 35
+ // AGP <7 (Unity 2021): use legacy key
+ if (project.android.hasProperty('compileSdk')) {
+ compileSdk compileSdkVersionVal
+ } else {
+ compileSdkVersion compileSdkVersionVal
+ }
🤖 Prompt for AI Agents
In CleverTap/Plugins/Android/clevertap-android-wrapper.androidlib/build.gradle
around lines 17 to 23, the use of the compileSdk property is not guarded and
will cause build failures in Unity 2021.3 (AGP 4.0.1) which does not recognize
it. To fix this, add a conditional check to only set compileSdk if the project
supports it, similar to the existing namespace check, ensuring compatibility
with Unity 2021.3 builds.
apply from: 'setupSymbols.gradle' | ||
apply from: '../shared/keepUnitySymbols.gradle' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure auxiliary Gradle scripts are included in the repo
setupSymbols.gradle
and ../shared/keepUnitySymbols.gradle
are now applied but are not part of Unity’s default template. Missing files will halt the Gradle sync.
If they’re generated at build time, document the generation step; otherwise commit them.
🤖 Prompt for AI Agents
In CTExample/Assets/Plugins/Android/launcherTemplate.gradle at lines 2 to 3, the
scripts setupSymbols.gradle and ../shared/keepUnitySymbols.gradle are applied
but not included in the repository. To fix this, either commit these Gradle
script files to the repo if they are static, or if they are generated during the
build process, add clear documentation in the project explaining how and when
these files are generated to ensure Gradle sync does not fail.
**DEFAULT_CONFIG_SETUP** | ||
minSdk **MINSDK** | ||
targetSdk **TARGETSDK** | ||
ndk { | ||
debugSymbolLevel **DEBUGSYMBOLLEVEL** | ||
abiFilters **ABIFILTERS** | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debugSymbolLevel
available only with NDK-sidestripper enabled
debugSymbolLevel
requires AGP 8 and the NDK side-stripper feature.
If the placeholder expands to an empty string it will generate invalid DSL (debugSymbolLevel
).
Guard the insertion (e.g., via $if(DEBUGSYMBOLLEVEL)$
) or default to debugSymbolLevel 'FULL'
.
🤖 Prompt for AI Agents
In CTExample/Assets/Plugins/Android/mainTemplate.gradle around lines 44 to 50,
the debugSymbolLevel property is inserted unconditionally, which can cause
invalid DSL if the placeholder is empty. To fix this, wrap the debugSymbolLevel
line with a conditional check to only include it if DEBUGSYMBOLLEVEL is set, or
provide a default value like 'FULL' to ensure valid syntax when the placeholder
is empty.
@@ -17,20 +18,21 @@ dependencies { | |||
implementation "com.google.android.exoplayer:exoplayer-ui:2.19.1" | |||
|
|||
// Optional CleverTap push templates | |||
implementation 'com.clevertap.android:push-templates:1.2.4' | |||
implementation 'com.clevertap.android:push-templates:1.4.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Confirm transitive FCM version pulled by push-templates:1.4.0
com.clevertap.android:push-templates:1.4.0
now transitively drags in Firebase BoM 32.x which in turn requires Play-services 22.x.
Unity projects that still ship their own (older) Firebase packages will hit DEX/classpath clashes.
Pro-tip: add an explicit Firebase BoM line here so that the version is deterministic, or document the expected range.
🤖 Prompt for AI Agents
In CTExample/Assets/Plugins/Android/mainTemplate.gradle at line 21, the
dependency 'com.clevertap.android:push-templates:1.4.0' transitively includes
Firebase BoM 32.x, which may conflict with older Firebase versions in Unity
projects. To fix this, explicitly add a Firebase BoM dependency with a specific
version in the gradle file to ensure a deterministic Firebase version and avoid
classpath clashes. Alternatively, document the expected Firebase version range
clearly.
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ') | ||
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~" | ||
}**PACKAGING_OPTIONS** | ||
}**PACKAGING** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Placeholder rename may break the post-processor
**PACKAGING_OPTIONS**
➜ **PACKAGING**
Search the Unity post-build replacer scripts (GradleTemplateParser.cs
, etc.) – they probably still substitute PACKAGING_OPTIONS
.
A missing replacement will leave the literal **PACKAGING**
in the generated build.gradle
and break the build.
🤖 Prompt for AI Agents
In CTExample/Assets/Plugins/Android/mainTemplate.gradle at line 63, the
placeholder was renamed from **PACKAGING_OPTIONS** to **PACKAGING**, but Unity's
post-build scripts like GradleTemplateParser.cs likely still expect
**PACKAGING_OPTIONS**. Revert the placeholder name back to **PACKAGING_OPTIONS**
to ensure the post-processor correctly replaces it and prevents build failures.
Summary by CodeRabbit
New Features
Bug Fixes
Chores