@@ -210,14 +210,25 @@ private static void DoBuildAndroid(String buildPath, bool isPlugin, bool isRelea
210210 // remove this line if you don't use a debugger and you want to speed up the flutter build
211211 playerOptions . options = BuildOptions . AllowDebugging | BuildOptions . Development ;
212212 }
213- #if UNITY_2022_1_OR_NEWER
213+ #if UNITY_6000_0_OR_NEWER
214+ PlayerSettings . SetIl2CppCompilerConfiguration ( NamedBuildTarget . Android , isReleaseBuild ? Il2CppCompilerConfiguration . Release : Il2CppCompilerConfiguration . Debug ) ;
215+ PlayerSettings . SetIl2CppCodeGeneration ( NamedBuildTarget . Android , isReleaseBuild ? Il2CppCodeGeneration . OptimizeSpeed : Il2CppCodeGeneration . OptimizeSize ) ;
216+ #elif UNITY_2022_1_OR_NEWER
214217 PlayerSettings . SetIl2CppCompilerConfiguration ( BuildTargetGroup . Android , isReleaseBuild ? Il2CppCompilerConfiguration . Release : Il2CppCompilerConfiguration . Debug ) ;
215218 PlayerSettings . SetIl2CppCodeGeneration ( NamedBuildTarget . Android , isReleaseBuild ? Il2CppCodeGeneration . OptimizeSpeed : Il2CppCodeGeneration . OptimizeSize ) ;
216219 #elif UNITY_2021_2_OR_NEWER
217220 PlayerSettings . SetIl2CppCompilerConfiguration ( BuildTargetGroup . Android , isReleaseBuild ? Il2CppCompilerConfiguration . Release : Il2CppCompilerConfiguration . Debug ) ;
218221 EditorUserBuildSettings . il2CppCodeGeneration = isReleaseBuild ? Il2CppCodeGeneration . OptimizeSpeed : Il2CppCodeGeneration . OptimizeSize ;
219222 #endif
220223
224+
225+ #if UNITY_ANDROID && UNITY_6000_0_OR_NEWER
226+ UnityEditor . Android . UserBuildSettings . DebugSymbols . level = isReleaseBuild ? Unity . Android . Types . DebugSymbolLevel . None : Unity . Android . Types . DebugSymbolLevel . SymbolTable ;
227+ UnityEditor . Android . UserBuildSettings . DebugSymbols . format = Unity . Android . Types . DebugSymbolFormat . LegacyExtensions ;
228+ #endif
229+ #if UNITY_ANDROID && UNITY_2023_1_OR_NEWER
230+ PlayerSettings . Android . applicationEntry = AndroidApplicationEntry . Activity ;
231+ #endif
221232 // Switch to Android standalone build.
222233 EditorUserBuildSettings . SwitchActiveBuildTarget ( BuildTargetGroup . Android , BuildTarget . Android ) ;
223234 // build addressable
@@ -229,6 +240,13 @@ private static void DoBuildAndroid(String buildPath, bool isPlugin, bool isRelea
229240
230241 Copy ( buildPath , AndroidExportPath ) ;
231242
243+ // Unity 6000 shared folder
244+ string sharedPath = Path . Combine ( APKPath , "shared" ) ;
245+ if ( Directory . Exists ( sharedPath ) )
246+ {
247+ Copy ( sharedPath , Path . Combine ( AndroidExportPath , "shared" ) ) ;
248+ }
249+
232250 // Modify build.gradle
233251 ModifyAndroidGradle ( isPlugin ) ;
234252
@@ -338,6 +356,10 @@ private static void ModifyAndroidGradle(bool isPlugin)
338356 // disable the Unity ndk path as it will conflict with Flutter.
339357 buildText = buildText . Replace ( "ndkPath \" " , "// ndkPath \" " ) ;
340358
359+ // Untiy 6000, handle ../shared/
360+ buildText = Regex . Replace ( buildText , @"\.\./shared/" , "./shared/" ) ;
361+
362+
341363 // check for namespace definition (Android gradle plugin 8+), add a backwards compatible version if it is missing.
342364 if ( ! buildText . Contains ( "namespace" ) )
343365 {
@@ -430,7 +452,10 @@ private static void BuildIOS(String path, bool isReleaseBuild)
430452 EditorUserBuildSettings . iOSBuildConfigType = iOSBuildType . Release ;
431453 #endif
432454
433- #if UNITY_2022_1_OR_NEWER
455+ #if UNITY_6000_0_OR_NEWER
456+ PlayerSettings . SetIl2CppCompilerConfiguration ( NamedBuildTarget . iOS , isReleaseBuild ? Il2CppCompilerConfiguration . Release : Il2CppCompilerConfiguration . Debug ) ;
457+ PlayerSettings . SetIl2CppCodeGeneration ( NamedBuildTarget . iOS , isReleaseBuild ? Il2CppCodeGeneration . OptimizeSpeed : Il2CppCodeGeneration . OptimizeSize ) ;
458+ #elif UNITY_2022_1_OR_NEWER
434459 PlayerSettings . SetIl2CppCompilerConfiguration ( BuildTargetGroup . iOS , isReleaseBuild ? Il2CppCompilerConfiguration . Release : Il2CppCompilerConfiguration . Debug ) ;
435460 PlayerSettings . SetIl2CppCodeGeneration ( NamedBuildTarget . iOS , isReleaseBuild ? Il2CppCodeGeneration . OptimizeSpeed : Il2CppCodeGeneration . OptimizeSize ) ;
436461 #elif UNITY_2021_2_OR_NEWER
0 commit comments