@@ -187,7 +187,7 @@ public static void ExploreFolder(string path)
187
187
}
188
188
189
189
// NOTE holding alt key (when using alt+o) brings up unity project selector
190
- public static Process LaunchProject ( Project proj , DataGrid dataGridRef = null )
190
+ public static Process LaunchProject ( Project proj , DataGrid dataGridRef = null , bool useInitScript = false )
191
191
{
192
192
// validate
193
193
if ( proj == null ) return null ;
@@ -253,6 +253,11 @@ public static Process LaunchProject(Project proj, DataGrid dataGridRef = null)
253
253
unitycommandlineparameters += " -buildTarget " + projTargetPlatform ;
254
254
}
255
255
256
+ if ( useInitScript == true )
257
+ {
258
+ unitycommandlineparameters += " -executeMethod UnityLauncherProTools.InitProject.Init" ;
259
+ }
260
+
256
261
Console . WriteLine ( "Start process: " + cmd + " " + unitycommandlineparameters ) ;
257
262
258
263
newProcess . StartInfo . Arguments = unitycommandlineparameters ;
@@ -1037,7 +1042,8 @@ public static string BrowseForOutputFolder(string title, string initialDirectory
1037
1042
return null ;
1038
1043
}
1039
1044
1040
- public static Project FastCreateProject ( string version , string baseFolder , string projectName = null , string templateZipPath = null , string [ ] platformsForThisUnity = null , string platform = null )
1045
+ // TODO too many params..
1046
+ public static Project FastCreateProject ( string version , string baseFolder , string projectName = null , string templateZipPath = null , string [ ] platformsForThisUnity = null , string platform = null , bool useInitScript = false , string initScriptPath = null )
1041
1047
{
1042
1048
// check for base folders in settings tab
1043
1049
if ( string . IsNullOrEmpty ( baseFolder ) == true )
@@ -1064,8 +1070,6 @@ public static Project FastCreateProject(string version, string baseFolder, strin
1064
1070
// if we didnt have name yet
1065
1071
if ( string . IsNullOrEmpty ( projectName ) == true )
1066
1072
{
1067
- //Console.WriteLine("version=" + version);
1068
- //Console.WriteLine("baseFolder=" + baseFolder);
1069
1073
projectName = GetSuggestedProjectName ( version , baseFolder ) ;
1070
1074
// failed getting new path a-z
1071
1075
if ( projectName == null ) return null ;
@@ -1081,6 +1085,21 @@ public static Project FastCreateProject(string version, string baseFolder, strin
1081
1085
TarLib . Tar . ExtractTarGz ( templateZipPath , newPath ) ;
1082
1086
}
1083
1087
1088
+ // copy init file into project
1089
+ if ( useInitScript == true )
1090
+ {
1091
+ var initScriptFile = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Scripts" , initScriptPath ) ;
1092
+ Console . WriteLine ( "initScriptFile: " + initScriptFile ) ;
1093
+ if ( File . Exists ( initScriptFile ) == true )
1094
+ {
1095
+ var editorTargetFolder = Path . Combine ( baseFolder , projectName , "Assets" , "Scripts" , "Editor" ) ;
1096
+ Console . WriteLine ( editorTargetFolder ) ;
1097
+ if ( Directory . Exists ( editorTargetFolder ) == false ) Directory . CreateDirectory ( editorTargetFolder ) ;
1098
+ var targetScriptFile = Path . Combine ( editorTargetFolder , initScriptPath ) ;
1099
+ if ( File . Exists ( targetScriptFile ) == false ) File . Copy ( initScriptFile , targetScriptFile ) ;
1100
+ }
1101
+ }
1102
+
1084
1103
// launch empty project
1085
1104
var proj = new Project ( ) ;
1086
1105
proj . Title = projectName ;
@@ -1089,8 +1108,10 @@ public static Project FastCreateProject(string version, string baseFolder, strin
1089
1108
proj . TargetPlatforms = platformsForThisUnity ;
1090
1109
proj . TargetPlatform = platform ;
1091
1110
proj . Modified = DateTime . Now ;
1092
- var proc = LaunchProject ( proj ) ;
1111
+
1112
+ var proc = LaunchProject ( proj , null , useInitScript ) ;
1093
1113
ProcessHandler . Add ( proj , proc ) ;
1114
+
1094
1115
return proj ;
1095
1116
} // FastCreateProject
1096
1117
@@ -1628,7 +1649,7 @@ public static bool CreateDesktopShortCut(Project proj, string batchFolder)
1628
1649
internal static long GetFolderSizeInBytes ( string currentBuildReportProjectPath )
1629
1650
{
1630
1651
if ( Directory . Exists ( currentBuildReportProjectPath ) == false ) return 0 ;
1631
-
1652
+
1632
1653
return DirSize ( new DirectoryInfo ( currentBuildReportProjectPath ) ) ;
1633
1654
}
1634
1655
0 commit comments