@@ -13,15 +13,16 @@ public class Build : MonoBehaviour
1313
1414 static readonly string apkPath = Path . Combine ( ProjectPath , "Builds/" + Application . productName + ".apk" ) ;
1515
16- static readonly string exportPath = Path . GetFullPath ( Path . Combine ( ProjectPath , "../../android/UnityExport" ) ) ;
16+ static readonly string androidExportPath = Path . GetFullPath ( Path . Combine ( ProjectPath , "../../android/UnityExport" ) ) ;
17+ static readonly string iosExportPath = Path . GetFullPath ( Path . Combine ( ProjectPath , "../../ios/UnityExport" ) ) ;
1718
1819 [ MenuItem ( "Flutter/Export Android (Unity 2019.3.*) %&n" , false , 1 ) ]
1920 public static void DoBuildAndroidLibrary ( )
2021 {
2122 DoBuildAndroid ( Path . Combine ( apkPath , "unityLibrary" ) ) ;
2223
2324 // Copy over resources from the launcher module that are used by the library
24- Copy ( Path . Combine ( apkPath + "/launcher/src/main/res" ) , Path . Combine ( exportPath , "src/main/res" ) ) ;
25+ Copy ( Path . Combine ( apkPath + "/launcher/src/main/res" ) , Path . Combine ( androidExportPath , "src/main/res" ) ) ;
2526 }
2627
2728 [ MenuItem ( "Flutter/Export Android %&a" , false , 2 ) ]
@@ -35,8 +36,8 @@ public static void DoBuildAndroid(String buildPath)
3536 if ( Directory . Exists ( apkPath ) )
3637 Directory . Delete ( apkPath , true ) ;
3738
38- if ( Directory . Exists ( exportPath ) )
39- Directory . Delete ( exportPath , true ) ;
39+ if ( Directory . Exists ( androidExportPath ) )
40+ Directory . Delete ( androidExportPath , true ) ;
4041
4142 EditorUserBuildSettings . androidBuildSystem = AndroidBuildSystem . Gradle ;
4243
@@ -51,37 +52,37 @@ public static void DoBuildAndroid(String buildPath)
5152 if ( report . summary . result != BuildResult . Succeeded )
5253 throw new Exception ( "Build failed" ) ;
5354
54- Copy ( buildPath , exportPath ) ;
55+ Copy ( buildPath , androidExportPath ) ;
5556
5657 // Modify build.gradle
57- var build_file = Path . Combine ( exportPath , "build.gradle" ) ;
58+ var build_file = Path . Combine ( androidExportPath , "build.gradle" ) ;
5859 var build_text = File . ReadAllText ( build_file ) ;
5960 build_text = build_text . Replace ( "com.android.application" , "com.android.library" ) ;
6061 build_text = build_text . Replace ( "implementation fileTree(dir: 'libs', include: ['*.jar'])" , "implementation project(':unity-classes')" ) ;
6162 build_text = Regex . Replace ( build_text , @"\n.*applicationId '.+'.*\n" , "\n " ) ;
6263 File . WriteAllText ( build_file , build_text ) ;
6364
6465 // Modify AndroidManifest.xml
65- var manifest_file = Path . Combine ( exportPath , "src/main/AndroidManifest.xml" ) ;
66+ var manifest_file = Path . Combine ( androidExportPath , "src/main/AndroidManifest.xml" ) ;
6667 var manifest_text = File . ReadAllText ( manifest_file ) ;
6768 manifest_text = Regex . Replace ( manifest_text , @"<application .*>" , "<application>" ) ;
6869 Regex regex = new Regex ( @"<activity.*>(\s|\S)+?</activity>" , RegexOptions . Multiline ) ;
6970 manifest_text = regex . Replace ( manifest_text , "" ) ;
7071 File . WriteAllText ( manifest_file , manifest_text ) ;
7172 }
7273
73- [ MenuItem ( "Flutter/Export IOS %&i" , false , 3 ) ]
74+ [ MenuItem ( "Flutter/Export IOS (Unity 2019.3.*) %&i" , false , 3 ) ]
7475 public static void DoBuildIOS ( )
7576 {
76- if ( Directory . Exists ( exportPath ) )
77- Directory . Delete ( exportPath , true ) ;
77+ if ( Directory . Exists ( iosExportPath ) )
78+ Directory . Delete ( iosExportPath , true ) ;
7879
7980 EditorUserBuildSettings . iOSBuildConfigType = iOSBuildType . Release ;
8081
8182 var options = BuildOptions . AcceptExternalModificationsToPlayer ;
8283 var report = BuildPipeline . BuildPlayer (
8384 GetEnabledScenes ( ) ,
84- exportPath ,
85+ iosExportPath ,
8586 BuildTarget . iOS ,
8687 options
8788 ) ;
0 commit comments