@@ -12,12 +12,23 @@ public class InitializeProject
1212 static string [ ] folders = new string [ ] { "Fonts" , "Materials" , "Models" , "Prefabs" , "Scenes" , "Scripts" , "Shaders" , "Sounds" , "Textures" } ;
1313
1414 static string assetsFolder ;
15+ static bool deleteFile = true ;
1516
1617 [ MenuItem ( "Tools/Initialize Project" ) ]
18+ public static void InitManually ( )
19+ {
20+ // called manually from menu, so dont delete file when testing
21+ deleteFile = false ;
22+ Init ( ) ;
23+ }
24+
25+ // this method is called from launcher, without parameters, so delete is called
1726 public static void Init ( )
1827 {
1928 assetsFolder = Application . dataPath ;
2029
30+ // TODO show window to select options for project init
31+
2132 CreateFolders ( ) ;
2233 // TODO adjust project settings, linear, company name
2334 // TODO remove extra packages
@@ -27,7 +38,13 @@ public static void Init()
2738 // TODO add mainscene to build scenes list
2839 // TODO adjust quality settings (but only in mobile?)
2940
30- // TODO self destruct this editor script file?
41+ // self destruct this editor script file
42+ if ( deleteFile == true )
43+ {
44+ var scriptPath = Path . Combine ( assetsFolder , "Scripts/Editor/InitializeProject.cs" ) ;
45+ if ( File . Exists ( scriptPath ) ) File . Delete ( scriptPath ) ;
46+ if ( File . Exists ( scriptPath + ".meta" ) ) File . Delete ( scriptPath + ".meta" ) ;
47+ }
3148
3249 // refresh folder
3350 AssetDatabase . Refresh ( ) ;
0 commit comments