private void RenameAction() { if (Event.current.type == EventType.Layout && renameAction) { if (string.IsNullOrEmpty(idbox)) { idbox = selectedRow.key; } else if (datatable.ContainsKey(idbox)) { string name = idbox; int y = 1; while (datatable.ContainsKey(name)) { name = idbox + "_" + y; y++; } idbox = name; } if (idbox != selectedRow.key) { datatable.DeleteEntry(selectedRow.key); selectedRow.key = idbox; datatable.SetEntry(idbox, (T)selectedRow.row); EditorUtility.SetDirty((ScriptableObject)datatable); GUI.FocusControl(""); OnSearchUpdated(); Repaint(); } } renameAction = false; }