public void DrawGUI() { var changedObj = target; foldout = EditorGUILayout.Foldout(foldout, "Copy & Paste"); if (foldout) { EditorGUILayout.BeginHorizontal("Box"); serializedObject.Update(); changedObj = EditorHelpers.CopyPastObjectButtons(changedObj); serializedObject.ApplyModifiedProperties(); EditorGUILayout.EndHorizontal(); } var cachedGuiColor = GUI.color; serializedObject.Update(); var property = serializedObject.GetIterator(); bool next = property.NextVisible(true); if (next) { do { GUI.color = cachedGuiColor; HandleProperty(property); }while (property.NextVisible(false)); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { EditorHelpers.CopyPastObjectButtons(serializedObject); var cachedGuiColor = GUI.color; serializedObject.Update(); var property = serializedObject.GetIterator(); bool next = property.NextVisible(true); if (next) { do { GUI.color = cachedGuiColor; HandleProperty(property); }while (property.NextVisible(false)); } serializedObject.ApplyModifiedProperties(); DrawGUI(); }