static public void ImportLayout() { string prefab = EditorTool.GetCurrentSelectedAssetPath(); string layout_file = LayoutTool.GetLayoutFullPath(prefab); if (string.IsNullOrEmpty(layout_file)) { return; } if (!File.Exists(layout_file)) { EditorUtility.DisplayDialog("", "\"" + layout_file + "\"不存在,无法导入", "确定"); return; } GameObject layout_obj = LayoutTool.LoadLayout(layout_file); Dictionary <GameObject, string> subPrefabs = LayoutTool.ProcessSubPrefabWhenImport(layout_obj); if (subPrefabs != null) { foreach (KeyValuePair <GameObject, string> kvp in subPrefabs) { ImportLayout(kvp.Key, kvp.Value); Object.DestroyImmediate(kvp.Key); } } ImportLayout(layout_obj, prefab); Object.DestroyImmediate(layout_obj); EditorUtility.DisplayDialog("", "导入成功", "确定"); }