public JSONObject GetComponentListJSON() { JSONObject componentListJSON = new JSONObject(JSONObject.Type.ARRAY); int index = 0; foreach (WXComponent component in componentList) { var result = component.GetJSON(); if (component.filePath != null && component.filePath != "" && component.filePath != ".prefab") // 只有prefab中的component可以获取其filePath { result.AddField("__prefab", component.filePath); } result.AddField("__fileId", WXUtility.GenerateLongByString(component.objectId.ToString() + component.getTypeName()).ToString()); result.AddField("_index", index++); if (result == null) { EditorUtility.DisplayDialog("Error", "导出compoennt为空 " + component.getTypeName(), "确定"); } else { componentListJSON.Add(result); } } return(componentListJSON); }