Skip to content

Commit fbda9c8

Browse files
committed
remove by str instead of index
caused problems if you had to remove more than one thing because as the lists get smaller the indices change
1 parent e5ad406 commit fbda9c8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,19 +393,23 @@ public static GUIContent[] GetDCCOptions(){
393393
}
394394

395395
// remove options that no longer exist
396-
List<int> toDelete = new List<int>();
396+
List<string> pathsToDelete = new List<string>();
397+
List<string> namesToDelete = new List<string>();
397398
for(int i = 0; i < instance.dccOptionPaths.Count; i++) {
398399
var dccPath = instance.dccOptionPaths [i];
399400
if (!File.Exists (dccPath)) {
400401
if (i == instance.selectedDCCApp) {
401402
instance.selectedDCCApp = 0;
402403
}
403-
instance.dccOptionNames.RemoveAt (i);
404-
toDelete.Add (i);
404+
namesToDelete.Add (instance.dccOptionNames [i]);
405+
pathsToDelete.Add (dccPath);
405406
}
406407
}
407-
foreach (var index in toDelete) {
408-
instance.dccOptionPaths.RemoveAt (index);
408+
foreach (var str in pathsToDelete) {
409+
instance.dccOptionPaths.Remove (str);
410+
}
411+
foreach (var str in namesToDelete) {
412+
instance.dccOptionNames.Remove (str);
409413
}
410414

411415
if (instance.dccOptionPaths.Count <= 0) {

0 commit comments

Comments
 (0)