Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9ff696b

Browse files
Apply updated Unity 6000 export scripts to master.
1 parent 1a38bb5 commit 9ff696b

File tree

6 files changed

+54
-8
lines changed

6 files changed

+54
-8
lines changed

‎example/unity/DemoApp/Assets/FlutterUnityIntegration/Editor/Build.cs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

‎example/unity/DemoApp/Assets/FlutterUnityIntegration/Editor/XCodePostBuild.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ public static class XcodePostBuild
4141
/// </summary>
4242
private const string TouchedMarker = "https://github.com/juicycleff/flutter-unity-view-widget";
4343

44+
// String used to detect where to inject function definitions in UnityAppController.h
45+
#if UNITY_6000_0_OR_NEWER
46+
private const string hDetection = "#import <UnityFramework/RenderPluginDelegate.h>";
47+
#else
48+
private const string hDetection = "include \"RenderPluginDelegate.h\"";
49+
#endif
50+
4451
//trigger this manually from build.cs as [PostProcessBuild] or IPostprocessBuildWithReport don't always seem to trigger.
4552
public static void PostBuild(BuildTarget target, string pathToBuiltProject)
4653
{
@@ -124,7 +131,7 @@ private static bool MarkUnityAppControllerH(string path)
124131
var mark = false;
125132
EditCodeFile(path, line =>
126133
{
127-
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
134+
inScope |= line.Contains(hDetection);
128135
if (inScope)
129136
{
130137
if (line.Trim() == "")
@@ -197,7 +204,7 @@ private static void EditUnityAppControllerH(string path)
197204
// Modify inline GetAppController
198205
EditCodeFile(path, line =>
199206
{
200-
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
207+
inScope |= line.Contains(hDetection);
201208

202209
if (inScope && !markerDetected)
203210
{
@@ -230,7 +237,7 @@ private static void EditUnityAppControllerH(string path)
230237
// Modify inline GetAppController
231238
EditCodeFile(path, line =>
232239
{
233-
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
240+
inScope |= line.Contains(hDetection);
234241

235242
if (inScope && !markerDetected)
236243
{

‎unitypackages/README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ Using the files from the example project ensures you have the latest version.
88
### Which one do I pick?
99
Try the newest one first.
1010

11-
Package versions do not indicate supported unity versions.
12-
For example `fuw-2022年1月7日f1.unitypackage` will work in Unity 2021 and even Unity 2019.
11+
Most changes are backwards compatible and package versions do not indicate required unity versions.
12+
For example `fuw-2022年1月7日f1.unitypackage` will still work in Unity 2021 and even Unity 2019.
13+
And the `600001` package is backwards compatible with Unity 2022.3 and earlier.
14+
1315

1416
If you really can't get it to work try to match version numbers.
1517
e.g if you use an older plugin version in the 4.x range, you might have to try unitypackages with 4.x versions.
@@ -31,10 +33,22 @@ Using a wrong extension like `.dll.txt` will disable it.
3133
# CHANGELOG
3234
Changes for `2022年1月7日f1` and earlier were collected retroactively and might not be complete.
3335

34-
## Pending (master branch)
36+
## Pending
3537
> Example Unity project, not in a unitypackage yet.
38+
* None
39+
40+
## 600001
41+
> fuw-600000.unitypackage
3642
* (Android) Handle missing `"game_view_content_description"` string in Unity output strings.xml.
3743

44+
## 600000
45+
> fuw-600000.unitypackage
46+
* Fix Android exports for Unity 6000.0 breaking changes.
47+
* Fix iOS exports for Unity 6000.0 breaking changes.
48+
**Note**
49+
* This package remains backwards compatible with previous Unity versions like 2022.3.
50+
* Android exports with Unity 6 are not compatible with the Flutter plugin 2022.x or earlier.
51+
3852
## 202230
3953
>fuw-202230.unitypackage
4054
* Avoid invalid iOS export when current build target is not iOS. [#838](https://github.com/juicycleff/flutter-unity-view-widget/pull/838)

‎unitypackages/fuw-600001.unitypackage

776 KB
Binary file not shown.
775 KB
Binary file not shown.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /