using UnityEngine; using UnityEditor; using System.Collections.Generic; using System.Linq; public class TEst : MonoBehaviour { public CityExcelData manager = new CityExcelData(); [ContextMenu("GetInfo")] public void CreateItemAsset() { manager.cityItems = null; manager.cityItems = ExcelTool.CreateItemArrayWithExcel(ExcelConfig.excelsFolderPath + "山东行政区划数据.xlsx"); for (int i = 0; i < transform.childCount; i++) { CityInfo c = transform.GetChild(i).GetComponent(); c.cityName = c.gameObject.name; for (int l = 0; l < manager.cityItems.Length; l++) { if (c.cityName == manager.cityItems[l].districtName) c.distCode = manager.cityItems[l].divisionNumber; } } } }