private void CalcuateAllPrefab(GameObject obj, Dictionary <int, UnitInfo> unitInfos) { if (obj == null) { return; } if (!obj.activeSelf || obj.hideFlags == HideFlags.DontSave) { return; } if (obj.GetComponent <SemaphoreMark>() || obj.GetComponent <IRootMark>() || obj.GetComponent <TreasureInfoMark>()) { return; } MapEditorUtility.SelectChildParticleSystem(obj); GameObject sourcePrefab = UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(obj);; if (sourcePrefab == null) { //TODO:继续往子节点进行遍历 int childCount = obj.transform.childCount; if (childCount > 0) { for (int iChild = 0; iChild < childCount; iChild++) { CalcuateAllPrefab(obj.transform.GetChild(iChild).gameObject, unitInfos); } } } else { UnitInfo unitInfo = new UnitInfo(); unitInfo.InstanceId = obj.GetInstanceID(); unitInfo.Unit = obj; MapEditorUtility.CaculateAABB(obj.transform, ref unitInfo.AABB); unitInfos.Add(unitInfo.InstanceId, unitInfo); } }