/// <summary> /// Copy the selected feedback /// </summary> void CopyFeedback(int id) { SerializedProperty property = _mmfeedbacks.GetArrayElementAtIndex(id); MMFeedback feedback = property.objectReferenceValue as MMFeedback; FeedbackCopy.Copy(new SerializedObject(feedback)); }
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; }