6
6
7
7
public class AdjustEditor : MonoBehaviour {
8
8
9
+ static string iOSBuildPath = "" ;
10
+
9
11
[ PostProcessBuild ]
10
12
public static void OnPostprocessBuild ( BuildTarget target , string pathToBuiltProject ) {
11
13
var exitCode = RunPostBuildScript ( preBuild : false , pathToBuiltProject : pathToBuiltProject ) ;
@@ -43,6 +45,23 @@ static void FixAndroidManifest() {
43
45
#endif
44
46
}
45
47
48
+ [ MenuItem ( "Adjust/Set iOS build path" ) ]
49
+ static void SetiOSBuildPath ( ) {
50
+ #if UNITY_IOS
51
+ AdjustEditor . iOSBuildPath = EditorUtility . OpenFolderPanel (
52
+ title : "iOs build path" ,
53
+ folder : EditorUserBuildSettings . GetBuildLocation ( BuildTarget . iPhone ) ,
54
+ defaultName : "" ) ;
55
+ if ( AdjustEditor . iOSBuildPath == "" ) {
56
+ UnityEngine . Debug . Log ( "iOS build path reset to default path" ) ;
57
+ } else {
58
+ UnityEngine . Debug . Log ( string . Format ( "iOS build path: {0}" , AdjustEditor . iOSBuildPath ) ) ;
59
+ }
60
+ #else
61
+ EditorUtility . DisplayDialog ( "Adjust" , "Option only valid for the Android platform." , "OK" ) ;
62
+ #endif
63
+ }
64
+
46
65
static int RunPostBuildScript ( bool preBuild , string pathToBuiltProject = "" ) {
47
66
string pathToScript = null ;
48
67
string arguments = null ;
@@ -54,7 +73,11 @@ static int RunPostBuildScript (bool preBuild, string pathToBuiltProject = "") {
54
73
arguments = "--pre-build " + arguments ;
55
74
#elif UNITY_IOS
56
75
pathToScript = "/Editor/AdjustPostBuildiOS" ;
57
- arguments = pathToBuiltProject ;
76
+ if ( AdjustEditor . iOSBuildPath == "" ) {
77
+ arguments = pathToBuiltProject ;
78
+ } else {
79
+ arguments = AdjustEditor . iOSBuildPath ;
80
+ }
58
81
#else
59
82
return - 1 ;
60
83
#endif
0 commit comments