static public void removeLod(int index, SerializedObject serializedObject, string prefix)
    {
        SerializedProperty serializedProperty = serializedObject.FindProperty(prefix);

        PiXYZLoDSettingsEditor.removeAt(index, serializedObject, prefix + "." + PiXYZLODSettings.serializePrefix);
        serializedProperty.FindPropertyRelative("lodSettingCount").intValue = serializedProperty.FindPropertyRelative("lodSettings").arraySize;
        serializedProperty.FindPropertyRelative("lodCurrentIndex").intValue = Math.Max(0,
                                                                                       Math.Min(serializedProperty.FindPropertyRelative("lodCurrentIndex").intValue,
                                                                                                serializedProperty.FindPropertyRelative("lodSettingCount").intValue - 1));
        serializedObject.ApplyModifiedProperties();
        PiXYZSettingsEditor.saveEditorPref(serializedObject, prefix);
    }