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