@@ -866,6 +866,9 @@ private void SaveSettingsOnExit()
866866
867867 public void UpdateUnityInstallationsList ( )
868868 {
869+ // keep currently selected row
870+ var currentSelection = GetSelectedUnity ( ) ;
871+
869872 // Reset preferred string, if user changed it
870873 //preferredVersion = "none";
871874
@@ -886,8 +889,21 @@ public void UpdateUnityInstallationsList()
886889 }
887890
888891 lblFoundXInstallations . Content = "Found " + unityInstallationsSource . Count + " installations" ;
889-
890892 btnCreateEmptyProject . IsEnabled = unityInstallationsSource . Count > 0 ;
893+
894+ // try to select previous selection
895+ if ( currentSelection != null )
896+ {
897+ for ( int i = 0 , len = unityInstallationsSource . Count ; i < len ; i ++ )
898+ {
899+ if ( unityInstallationsSource [ i ] . Version == currentSelection . Version && unityInstallationsSource [ i ] . Path == currentSelection . Path )
900+ {
901+ dataGridUnitys . SelectedIndex = i ;
902+ Tools . SetFocusToGrid ( dataGridUnitys ) ;
903+ break ;
904+ }
905+ }
906+ }
891907 }
892908
893909 Project GetSelectedProject ( )
@@ -2100,7 +2116,19 @@ void CreateNewEmptyProject(string targetFolder = null)
21002116 }
21012117 }
21022118
2103- // refresh unity installations
2119+ string newVersion = null ;
2120+
2121+ // if in maintab
2122+ if ( tabControl . SelectedIndex == 0 )
2123+ {
2124+ newVersion = GetSelectedProject ( ) ? . Version == null ? preferredVersion : GetSelectedProject ( ) . Version ;
2125+ }
2126+ else // unity tab
2127+ {
2128+ newVersion = ( GetSelectedUnity ( ) == null || GetSelectedUnity ( ) . Version == null ) ? preferredVersion : GetSelectedUnity ( ) . Version ;
2129+ }
2130+
2131+ // refresh unity installations (so that latest installs are listed)
21042132 UpdateUnityInstallationsList ( ) ;
21052133
21062134 if ( string . IsNullOrEmpty ( initScriptFileFullPath ) == true )
@@ -2111,25 +2139,12 @@ void CreateNewEmptyProject(string targetFolder = null)
21112139 // for new projects created from explorer, always ask for name
21122140 if ( chkAskNameForQuickProject . IsChecked == true || targetFolder != null )
21132141 {
2114- string newVersion = null ;
2115-
2116- // if in maintab
2117- if ( tabControl . SelectedIndex == 0 )
2118- {
2119- newVersion = GetSelectedProject ( ) ? . Version == null ? preferredVersion : GetSelectedProject ( ) . Version ;
2120- }
2121- else // unity tab
2122- {
2123- newVersion = ( GetSelectedUnity ( ) == null || GetSelectedUnity ( ) . Version == null ) ? preferredVersion : GetSelectedUnity ( ) . Version ;
2124- }
2125-
21262142 if ( string . IsNullOrEmpty ( newVersion ) )
21272143 {
21282144 Console . WriteLine ( "Missing selected Unity version, probably launching from context menu" ) ;
21292145 newVersion = preferredVersion ;
21302146 // if no preferred version, use latest
21312147 if ( string . IsNullOrEmpty ( newVersion ) ) newVersion = unityInstallationsSource [ 0 ] . Version ;
2132-
21332148 }
21342149
21352150 string suggestedName = targetFolder != null ? Path . GetFileName ( targetFolder ) : Tools . GetSuggestedProjectName ( newVersion , rootFolder ) ;
@@ -2164,22 +2179,10 @@ void CreateNewEmptyProject(string targetFolder = null)
21642179 }
21652180 else // use automatic name (project is instantly created, without asking anything)
21662181 {
2167- string newVersion = null ;
2168- // if in maintab
2169- if ( tabControl . SelectedIndex == 0 )
2170- {
2171- newVersion = GetSelectedProject ( ) . Version == null ? preferredVersion : GetSelectedProject ( ) . Version ;
2172- }
2173- else // unity tab
2174- {
2175- newVersion = GetSelectedUnity ( ) . Version == null ? preferredVersion : GetSelectedUnity ( ) . Version ;
2176- }
21772182 var p = Tools . FastCreateProject ( newVersion , rootFolder , null , null , null , null , ( bool ) chkUseInitScript . IsChecked , initScriptFileFullPath ) ;
2178-
21792183 if ( p != null ) AddNewProjectToList ( p ) ;
21802184 }
2181-
2182- }
2185+ } // CreateNewEmptyProject
21832186
21842187 private void ChkAskNameForQuickProject_Checked ( object sender , RoutedEventArgs e )
21852188 {
0 commit comments