/// <summary> /// Draws the add row button. /// </summary> /// <param name="unityInterface">The unity interface.</param> /// <param name="currentIndex">Index of the current.</param> /// <param name="chosenMethods">The chosen methods.</param> /// <param name="target">The target.</param> /// <param name="undoText">The undo text.</param> /// <param name="newChosenMethods">The new chosen methods.</param> /// <param name="newUndoText">The new undo text.</param> /// <returns>Returns true if the inspector needs to be redrawn.</returns> public bool DrawAddRowButton(IUnityInterfaceWrapper unityInterface, int currentIndex, ChosenMethods chosenMethods, UnityEngine.Object target, string undoText, out ChosenMethods newChosenMethods, out string newUndoText) { newUndoText = undoText; bool dirty = false; newChosenMethods = new ChosenMethods(); newChosenMethods.ChosenMethodsNames = chosenMethods.ChosenMethodsNames; newChosenMethods.ChosenMethodsParametersIndex = chosenMethods.ChosenMethodsParametersIndex; if (unityInterface.GUILayoutButton("+", EditorStyles.miniButton, unityInterface.GUILayoutWidth(20))) { newUndoText = "Add Step Method row"; string[] newArrayMethodsNames = new string[newChosenMethods.ChosenMethodsNames.Length + 1]; string[] newArrayMethodsParametersIndex = new string[newChosenMethods.ChosenMethodsParametersIndex.Length + 1]; int newIndex = 0; for (int tempIndex = 0; tempIndex < chosenMethods.ChosenMethodsNames.Length; tempIndex++) { if (tempIndex == currentIndex + 1) { newArrayMethodsNames[newIndex] = string.Empty; newArrayMethodsParametersIndex[newIndex] = string.Empty; newIndex++; } newArrayMethodsNames[newIndex] = newChosenMethods.ChosenMethodsNames[tempIndex]; newArrayMethodsParametersIndex[newIndex] = newChosenMethods.ChosenMethodsParametersIndex[tempIndex]; newIndex++; } if (newArrayMethodsNames[newArrayMethodsNames.Length - 1] == null) { newArrayMethodsNames[newArrayMethodsNames.Length - 1] = string.Empty; newArrayMethodsParametersIndex[newArrayMethodsNames.Length - 1] = string.Empty; } newChosenMethods.ChosenMethodsNames = newArrayMethodsNames; newChosenMethods.ChosenMethodsParametersIndex = newArrayMethodsParametersIndex; unityInterface.EditorUtilitySetDirty(target); dirty = true; } return(dirty); }