bool RenameCategory(string fromName, string toName) { BarChart barChart = (BarChart)serializedObject.targetObject; try { barChart.DataSource.RenameCategory(fromName, toName); } catch (Exception) { return(false); } serializedObject.Update(); if (barChart.gameObject.activeInHierarchy) { barChart.GenerateChart(); } else { EditorUtility.SetDirty(barChart); } return(true); }