Skip to content

Commit ec5ee60

Browse files
committed
new project: autoselect win64 if no matching platform in selected unity, disable process hidden window on launch (whole editor was invisible)
1 parent b36f67a commit ec5ee60

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Diff for: UnityLauncherPro/NewProject.xaml.cs

+18-3
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,36 @@ void UpdateModulesDropdown(string version)
108108
// get modules and stick into combobox, NOTE we already have this info from GetProjects.Scan, so could access it
109109
platformsForThisUnity = Tools.GetPlatformsForUnityVersion(version);
110110
cmbNewProjectPlatform.ItemsSource = platformsForThisUnity;
111-
//System.Console.WriteLine(Tools.GetPlatformsForUnityVersion(version).Length);
112111

113112
var lastUsedPlatform = Properties.Settings.Default.newProjectPlatform;
114113

115114
for (int i = 0; i < platformsForThisUnity.Length; i++)
116115
{
117116
// set default platform (win64) if never used this setting before
118-
if ((lastUsedPlatform == null && platformsForThisUnity[i].ToLower() == "win64") || platformsForThisUnity[i] == lastUsedPlatform)
117+
if ((string.IsNullOrEmpty(lastUsedPlatform) && platformsForThisUnity[i].ToLower() == "win64") || platformsForThisUnity[i] == lastUsedPlatform)
119118
{
120119
cmbNewProjectPlatform.SelectedIndex = i;
121120
break;
122121
}
123122
}
124123

125-
//lblTemplateTitleAndCount.Content = "Templates: (" + (cmbNewProjectTemplate.Items.Count - 1) + ")";
124+
// if nothing found, use win64
125+
if (cmbNewProjectPlatform.SelectedIndex == -1)
126+
{
127+
//cmbNewProjectPlatform.SelectedIndex = cmbNewProjectPlatform.Items.Count > 1 ? 1 : 0;
128+
for (int i = 0; i < platformsForThisUnity.Length; i++)
129+
{
130+
if (platformsForThisUnity[i].ToLower() == "win64")
131+
{
132+
cmbNewProjectPlatform.SelectedIndex = i;
133+
break;
134+
}
135+
}
136+
137+
// if still nothing, use first
138+
if (cmbNewProjectPlatform.SelectedIndex == -1) cmbNewProjectPlatform.SelectedIndex = 0;
139+
//lblTemplateTitleAndCount.Content = "Templates: (" + (cmbNewProjectTemplate.Items.Count - 1) + ")";
140+
}
126141
}
127142

128143
private void BtnCreateNewProject_Click(object sender, RoutedEventArgs e)

Diff for: UnityLauncherPro/Tools.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public static Process LaunchProject(Project proj, DataGrid dataGridRef = null, b
301301

302302
newProcess.StartInfo.Arguments = unitycommandlineparameters;
303303
newProcess.EnableRaisingEvents = true;
304-
newProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; // needed for unity 2023 for some reason? (otherwise console popups briefly)
304+
//newProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; // needed for unity 2023 for some reason? (otherwise console popups briefly), Cannot use this, whole Editor is invisible then
305305
newProcess.Start();
306306

307307
if (Properties.Settings.Default.closeAfterProject)

0 commit comments

Comments
 (0)