@@ -187,7 +187,7 @@ public static void ExploreFolder(string path)
187187 }
188188
189189 // 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 )
191191 {
192192 // validate
193193 if ( proj == null ) return null ;
@@ -253,6 +253,11 @@ public static Process LaunchProject(Project proj, DataGrid dataGridRef = null)
253253 unitycommandlineparameters += " -buildTarget " + projTargetPlatform ;
254254 }
255255
256+ if ( useInitScript == true )
257+ {
258+ unitycommandlineparameters += " -executeMethod UnityLauncherProTools.InitProject.Init" ;
259+ }
260+
256261 Console . WriteLine ( "Start process: " + cmd + " " + unitycommandlineparameters ) ;
257262
258263 newProcess . StartInfo . Arguments = unitycommandlineparameters ;
@@ -1037,7 +1042,8 @@ public static string BrowseForOutputFolder(string title, string initialDirectory
10371042 return null ;
10381043 }
10391044
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 )
10411047 {
10421048 // check for base folders in settings tab
10431049 if ( string . IsNullOrEmpty ( baseFolder ) == true )
@@ -1064,8 +1070,6 @@ public static Project FastCreateProject(string version, string baseFolder, strin
10641070 // if we didnt have name yet
10651071 if ( string . IsNullOrEmpty ( projectName ) == true )
10661072 {
1067- //Console.WriteLine("version=" + version);
1068- //Console.WriteLine("baseFolder=" + baseFolder);
10691073 projectName = GetSuggestedProjectName ( version , baseFolder ) ;
10701074 // failed getting new path a-z
10711075 if ( projectName == null ) return null ;
@@ -1081,6 +1085,21 @@ public static Project FastCreateProject(string version, string baseFolder, strin
10811085 TarLib . Tar . ExtractTarGz ( templateZipPath , newPath ) ;
10821086 }
10831087
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+
10841103 // launch empty project
10851104 var proj = new Project ( ) ;
10861105 proj . Title = projectName ;
@@ -1089,8 +1108,10 @@ public static Project FastCreateProject(string version, string baseFolder, strin
10891108 proj . TargetPlatforms = platformsForThisUnity ;
10901109 proj . TargetPlatform = platform ;
10911110 proj . Modified = DateTime . Now ;
1092- var proc = LaunchProject ( proj ) ;
1111+
1112+ var proc = LaunchProject ( proj , null , useInitScript ) ;
10931113 ProcessHandler . Add ( proj , proc ) ;
1114+
10941115 return proj ;
10951116 } // FastCreateProject
10961117
@@ -1628,7 +1649,7 @@ public static bool CreateDesktopShortCut(Project proj, string batchFolder)
16281649 internal static long GetFolderSizeInBytes ( string currentBuildReportProjectPath )
16291650 {
16301651 if ( Directory . Exists ( currentBuildReportProjectPath ) == false ) return 0 ;
1631-
1652+
16321653 return DirSize ( new DirectoryInfo ( currentBuildReportProjectPath ) ) ;
16331654 }
16341655
0 commit comments