Skip to content

Commit f2fc7fa

Browse files
committed
update unity installations when create new project, disable new project button if no unity editors found (fixes #216)
1 parent e1edf08 commit f2fc7fa

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

UnityLauncherPro/MainWindow.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,8 @@ void UpdateUnityInstallationsList()
886886
}
887887

888888
lblFoundXInstallations.Content = "Found " + unityInstallationsSource.Count + " installations";
889+
890+
btnCreateEmptyProject.IsEnabled = unityInstallationsSource.Count > 0;
889891
}
890892

891893
Project GetSelectedProject()
@@ -2099,6 +2101,9 @@ void CreateNewEmptyProject(string targetFolder = null)
20992101
}
21002102
}
21012103

2104+
// refresh unity installations
2105+
UpdateUnityInstallationsList();
2106+
21022107
if (string.IsNullOrEmpty(initScriptFileFullPath) == true)
21032108
{
21042109
initScriptFileFullPath = Tools.GetSafeFilePath("Scripts", "InitializeProject.cs");

UnityLauncherPro/NewProject.xaml.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Linq;
45
using System.Net.Http;
56
using System.Text;
67
using System.Threading;
@@ -53,6 +54,18 @@ public NewProject(string unityVersion, string suggestedName, string targetFolder
5354
txtNewProjectName.Text = newName;
5455
txtNewProjectFolder.Text = targetFolder;
5556

57+
if (MainWindow.unityInstallationsSource.Count == 0)
58+
{
59+
Tools.SetStatus("No Unity installations found! Please add Unity installations first.");
60+
isInitializing = false;
61+
btnCreateNewProject.IsEnabled = false;
62+
return;
63+
}
64+
else
65+
{
66+
btnCreateNewProject.IsEnabled = true;
67+
}
68+
5669
// fill available versions
5770
if (gridAvailableVersions.ItemsSource == null)
5871
{

0 commit comments

Comments
 (0)