/// <summary> /// Creates a new feedback and applies the previoulsy copied feedback values /// </summary> protected virtual void PasteAsNew() { MMFeedback newFeedback = AddFeedback(FeedbackCopy.Type); SerializedObject serialized = new SerializedObject(newFeedback); serialized.Update(); FeedbackCopy.Paste(serialized); serialized.ApplyModifiedProperties(); }
/// <summary> /// Paste the previously copied feedback values into the selected feedback /// </summary> void PasteFeedback(int id) { SerializedProperty property = _mmfeedbacks.GetArrayElementAtIndex(id); MMFeedback feedback = property.objectReferenceValue as MMFeedback; SerializedObject serialized = new SerializedObject(feedback); FeedbackCopy.Paste(serialized); serialized.ApplyModifiedProperties(); }
static public void PasteAll(MMFeedbacksEditor targetEditor) { var sourceFeedbacks = new SerializedObject(MMFeedbacksConfiguration.Instance._mmFeedbacks); SerializedProperty feedbacks = sourceFeedbacks.FindProperty("Feedbacks"); for (int i = 0; i < feedbacks.arraySize; i++) { MMFeedback arrayFeedback = (feedbacks.GetArrayElementAtIndex(i).objectReferenceValue as MMFeedback); FeedbackCopy.Copy(new SerializedObject(arrayFeedback)); MMFeedback newFeedback = targetEditor.AddFeedback(arrayFeedback.GetType()); SerializedObject serialized = new SerializedObject(newFeedback); serialized.Update(); FeedbackCopy.Paste(serialized); serialized.ApplyModifiedProperties(); } MMFeedbacksConfiguration.Instance._mmFeedbacks = null; }