@@ -178,13 +178,15 @@ public override void OnInspectorGUI() {
178
178
179
179
EditorGUILayout . Space ( ) ;
180
180
181
-
181
+ // disable button if no 3D application is available
182
+ EditorGUI . BeginDisabledGroup ( ! ExportSettings . CanInstall ( ) ) ;
182
183
var installIntegrationContent = new GUIContent (
183
184
"Install Unity Integration" ,
184
185
"Install and configure the Unity integration for the selected 3D application so that you can import and export directly with this project." ) ;
185
186
if ( GUILayout . Button ( installIntegrationContent ) ) {
186
187
FbxExporters . Editor . IntegrationsUI . InstallDCCIntegration ( ) ;
187
188
}
189
+ EditorGUI . EndDisabledGroup ( ) ;
188
190
189
191
GUILayout . FlexibleSpace ( ) ;
190
192
GUILayout . EndScrollView ( ) ;
@@ -599,9 +601,8 @@ public static GUIContent[] GetDCCOptions(){
599
601
instance . dccOptionNames = new List < string > ( ) ;
600
602
FindDCCInstalls ( ) ;
601
603
}
602
-
603
- // store the selected app
604
- var prevSelection = instance . dccOptionPaths [ instance . selectedDCCApp ] ;
604
+ // store the selected app if any
605
+ string prevSelection = GetSelectedDCCPath ( ) ;
605
606
606
607
// remove options that no longer exist
607
608
List < string > pathsToDelete = new List < string > ( ) ;
@@ -724,12 +725,21 @@ public static bool IsEarlierThanMax2017(string AppName){
724
725
725
726
public static string GetSelectedDCCPath ( )
726
727
{
727
- return ( instance . dccOptionPaths . Count > 0 ) ? instance . dccOptionPaths [ instance . selectedDCCApp ] : "" ;
728
+ return ( instance . dccOptionPaths . Count > 0 &&
729
+ instance . selectedDCCApp >= 0 &&
730
+ instance . selectedDCCApp < instance . dccOptionPaths . Count ) ? instance . dccOptionPaths [ instance . selectedDCCApp ] : "" ;
728
731
}
729
732
730
733
public static string GetSelectedDCCName ( )
731
734
{
732
- return ( instance . dccOptionPaths . Count > 0 ) ? instance . dccOptionNames [ instance . selectedDCCApp ] : "" ;
735
+ return ( instance . dccOptionNames . Count > 0 &&
736
+ instance . selectedDCCApp >= 0 &&
737
+ instance . selectedDCCApp < instance . dccOptionNames . Count ) ? instance . dccOptionNames [ instance . selectedDCCApp ] : "" ;
738
+ }
739
+
740
+ public static bool CanInstall ( )
741
+ {
742
+ return instance . dccOptionPaths . Count > 0 ;
733
743
}
734
744
735
745
/// <summary>
0 commit comments