private void ReportSceneAtPath(StringBuilder sb, string scenePath) { var scene = EditorSceneManager.OpenScene(scenePath); sb.Append("{"); AssetsReporterUtils.AddJsonObject(sb, "buildIndex", scene.buildIndex).Append(",\n"); AssetsReporterUtils.AddJsonObject(sb, "path", scenePath).Append(",\n"); AssetsReporterUtils.AddJsonObject(sb, "sceneName", scene.name).Append(",\n"); AssetsReporterUtils.AddJsonObject(sb, "rootCount", scene.rootCount).Append(",\n"); ReportSceneDependAssets(sb, scenePath); sb.Append(","); var rootObjects = scene.GetRootGameObjects(); int allGameObjectCount = 0; int allComponentCount = 0; int allMonoBehaviourCount = 0; var componentsCountDictionary = new Dictionary <string, int>(1024); foreach (var rootObj in rootObjects) { allGameObjectCount += CountChildTransform(rootObj.transform); var childComponents = rootObj.GetComponentsInChildren <Component>(); var childMonoBehaviour = rootObj.GetComponentsInChildren <MonoBehaviour>(); if (childComponents != null) { allComponentCount += childComponents.Length; } if (childMonoBehaviour != null) { allMonoBehaviourCount += childMonoBehaviour.Length; } AddToConpoenentCountDictionary(componentsCountDictionary, childComponents); } AssetsReporterUtils.AddJsonObject(sb, "allGameObjects", allGameObjectCount).Append(","); AssetsReporterUtils.AddJsonObject(sb, "allComponents", allComponentCount).Append(","); AssetsReporterUtils.AddJsonObject(sb, "allMonoBehaviour", allMonoBehaviourCount).Append(","); AssetsReporterUtils.AddJsonToContDictionary(sb, "componentCount", componentsCountDictionary); sb.Append("}"); }