public void OnRenameLayer(InputField inputField) { string oldLayerName = modifyLayer.LayerName; string newLayerName = inputField.text; if (!string.IsNullOrEmpty(newLayerName)) { mapLayers.RenameLayer(modifyLayer.LayerName, newLayerName); MapLayers.MapLayer newLayer = mapLayers.GetMapLayer(newLayerName); if (newLayer != null) { //rename layer successfully string btnText = newLayerName; if (selectLayers == oldLayerName) { selectLayers = newLayerName; btnText = "[" + modifyLayer.LayerName + "]"; } modifyLayerBtnText.text = btnText; } } OnCloseModifyPanelBtnClicked(); }