private void ShowGestureListButtons(SerializedProperty list, int index) { // plus button if (GUILayout.Button(duplicateButtonContent, EditorStyles.miniButtonMid, miniButtonWidth)) { //Focus has changed from a Gesture Control. if (IfGestureControl(selectedFocus)) { ChangeGestureName(selectedFocus); } selectedFocus = ""; var option = DisplayDialogForGestureCreation(); switch (option) { // Create Single Gesture case 0: CreateNewGesture(list, false); break; // Create Double Gesture case 1: CreateNewGesture(list, true); break; // Cancel - do nothing case 2: break; } } // minus button if (GUILayout.Button(deleteButtonContent, EditorStyles.miniButtonRight, miniButtonWidth)) { // new way to delete using vrGestureManager directly string gestureName = list.GetArrayElementAtIndex(index).FindPropertyRelative("name").stringValue; gestureSettings.DeleteGesture(gestureName); // old way to delete from property //int oldSize = list.arraySize; //list.DeleteArrayElementAtIndex(index); //if (list.arraySize == oldSize) // list.DeleteArrayElementAtIndex(index); } }
public void DeleteGesture(string gestureName) { gestureSettings.DeleteGesture(gestureName); }