void OnGUI() { if (Event.current.type == EventType.Layout) { _noGuiSkinFound = _usedSkin == null; _loadingValuesFromThread = !string.IsNullOrEmpty(GetValueMessage); _buildInfoHasNoContentsToDisplay = !BuildReportTool.Util.BuildInfoHasContents(_buildInfo); } //GUI.Label(new Rect(5, 100, 800, 20), "BuildReportTool.Util.ShouldReload: " + BuildReportTool.Util.ShouldReload + " EditorApplication.isCompiling: " + EditorApplication.isCompiling); if (_noGuiSkinFound) { GUI.Label(new Rect(20, 20, 500, 100), BuildReportTool.Options.BUILD_REPORT_PACKAGE_MISSING_MSG); return; } GUI.skin = _usedSkin; DrawTopRowButtons(); GUI.Label(new Rect(0, 0, position.width, 20), BuildReportTool.Info.ReadableVersion, BuildReportTool.Window.Settings.VERSION_STYLE_NAME); // loading message if (LoadingValuesFromThread) { DrawCentralMessage(GetValueMessage); return; } bool requestRepaint = false; // content to show when there is no build report on display if (_buildInfoHasNoContentsToDisplay) { if (IsInOptionsCategory) { GUILayout.Space(40); _optionsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaint); } else if (IsInHelpCategory) { GUILayout.Space(40); _helpScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaint); } else if (IsWaitingForBuildCompletionToGenerateBuildReport) { DrawCentralMessage(Labels.WAITING_FOR_BUILD_TO_COMPLETE_MSG); } else { DrawCentralMessage(Labels.NO_BUILD_INFO_FOUND_MSG); if (ReportGenerator.CheckIfUnityHasNoLogArgument()) { DrawWarningMessage(Labels.FOUND_NO_LOG_ARGUMENT_MSG); } } if (requestRepaint) { Repaint(); } return; } GUILayout.Space(50); // top padding (top row buttons are 40 pixels) var mouseHasMoved = Mathf.Abs(Event.current.mousePosition.x - _lastMousePos.x) > 0 || Mathf.Abs(Event.current.mousePosition.y - _lastMousePos.y) > 0; // category buttons int oldSelectedCategoryIdx = _selectedCategoryIdx; GUILayout.BeginHorizontal(); if (GUILayout.Toggle(IsInOverviewCategory, "Overview", BuildReportTool.Window.Settings.TAB_LEFT_STYLE_NAME, GUILayout.ExpandWidth(true))) { _selectedCategoryIdx = OVERVIEW_IDX; } if (GUILayout.Toggle(IsInBuildSettingsCategory, "Project Settings", BuildReportTool.Window.Settings.TAB_MIDDLE_STYLE_NAME, GUILayout.ExpandWidth(true))) { _selectedCategoryIdx = BUILD_SETTINGS_IDX; } if (GUILayout.Toggle(IsInSizeStatsCategory, "Size Stats", BuildReportTool.Window.Settings.TAB_MIDDLE_STYLE_NAME, GUILayout.ExpandWidth(true))) { _selectedCategoryIdx = SIZE_STATS_IDX; } if (GUILayout.Toggle(IsInUsedAssetsCategory, "Used Assets", BuildReportTool.Window.Settings.TAB_MIDDLE_STYLE_NAME, GUILayout.ExpandWidth(true))) { _selectedCategoryIdx = USED_ASSETS_IDX; } if (GUILayout.Toggle(IsInUnusedAssetsCategory, "Unused Assets", BuildReportTool.Window.Settings.TAB_RIGHT_STYLE_NAME, GUILayout.ExpandWidth(true))) { _selectedCategoryIdx = UNUSED_ASSETS_IDX; } /*GUILayout.Space(20); * * if (GUILayout.Toggle(IsInOptionsCategory, _toolbarLabelOptions, BuildReportTool.Window.Settings.TAB_LEFT_STYLE_NAME, GUILayout.ExpandWidth(true))) * { * _selectedCategoryIdx = OPTIONS_IDX; * } * if (GUILayout.Toggle(IsInHelpCategory, _toolbarLabelHelp, BuildReportTool.Window.Settings.TAB_RIGHT_STYLE_NAME, GUILayout.ExpandWidth(true))) * { * _selectedCategoryIdx = HELP_IDX; * }*/ GUILayout.EndHorizontal(); if (oldSelectedCategoryIdx != OPTIONS_IDX && _selectedCategoryIdx == OPTIONS_IDX) { // moving into the options screen _fileFilterGroupToUseOnOpeningOptionsWindow = BuildReportTool.Options.FilterToUseInt; } else if (oldSelectedCategoryIdx == OPTIONS_IDX && _selectedCategoryIdx != OPTIONS_IDX) { // moving away from the options screen _fileFilterGroupToUseOnClosingOptionsWindow = BuildReportTool.Options.FilterToUseInt; if (_fileFilterGroupToUseOnOpeningOptionsWindow != _fileFilterGroupToUseOnClosingOptionsWindow) { RecategorizeDisplayedBuildInfo(); } } bool requestRepaintOnTabs = false; // main content GUILayout.BeginHorizontal(); //GUILayout.Space(3); // left padding GUILayout.BeginVertical(); if (IsInOverviewCategory) { _overviewScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs); } else if (IsInBuildSettingsCategory) { _buildSettingsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs); } else if (IsInSizeStatsCategory) { _sizeStatsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs); } else if (IsInUsedAssetsCategory) { _usedAssetsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs); } else if (IsInUnusedAssetsCategory) { _unusedAssetsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs); } else if (IsInOptionsCategory) { _optionsScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs); } else if (IsInHelpCategory) { _helpScreen.DrawGUI(position, _buildInfo, _assetDependencies, out requestRepaintOnTabs); } GUILayout.FlexibleSpace(); GUILayout.EndVertical(); //GUILayout.Space(5); // right padding GUILayout.EndHorizontal(); //GUILayout.Space(10); // bottom padding if (requestRepaintOnTabs) { _buildInfo.FlagOkToRefresh(); } _lastMousePos = Event.current.mousePosition; _lastMouseMoved = mouseHasMoved; }
static void RefreshUnusedAssetsBatch(BuildInfo buildInfo, FileFilterGroup filtersToUse) { if (buildInfo.UnusedAssetsIncludedInCreation) { BRT_BuildReportWindow.GetValueMessage = "Getting list of unused assets..."; List<BuildReportTool.SizePart> allUsed = buildInfo.UsedAssets.GetAllAsList(); BuildReportTool.SizePart[] allUnused; BuildReportTool.SizePart[][] perCategoryUnused; BuildPlatform buildPlatform = GetBuildPlatformFromString(buildInfo.BuildType, buildInfo.BuildTargetUsed); allUnused = GetAllUnusedAssets(buildInfo.ScenesIncludedInProject, buildInfo.ScriptDLLs, buildInfo.ProjectAssetsPath, buildInfo.IncludedSvnInUnused, buildInfo.IncludedGitInUnused, buildPlatform, buildInfo.UnusedPrefabsIncludedInCreation, buildInfo.UnusedAssetsBatchNum, buildInfo.UnusedAssetsEntriesPerBatch, allUsed); if (allUnused != null && allUnused.Length > 0) { perCategoryUnused = SegregateAssetSizesPerCategory(allUnused, filtersToUse); AssetList.SortType previousUnusedSortType = buildInfo.UnusedAssets.CurrentSortType; AssetList.SortOrder previousUnusedSortOrder = buildInfo.UnusedAssets.CurrentSortOrder; buildInfo.UnusedAssets = new AssetList(); buildInfo.UnusedAssets.Init(allUnused, perCategoryUnused, filtersToUse, previousUnusedSortType, previousUnusedSortOrder); buildInfo.UnusedAssets.PopulateImportedSizes(); if (allUsed.Count != buildInfo.UsedAssets.AllCount) { // it means GetAllUnusedAssets() found new used assets // re-assign all used and re-sort BuildReportTool.SizePart[] newAllUsedArray = allUsed.ToArray(); BuildReportTool.SizePart[][] newPerCategoryUsed = SegregateAssetSizesPerCategory(newAllUsedArray, filtersToUse); AssetList.SortType previousUsedSortType = buildInfo.UsedAssets.CurrentSortType; AssetList.SortOrder previousUsedSortOrder = buildInfo.UsedAssets.CurrentSortOrder; buildInfo.UsedAssets = new AssetList(); buildInfo.UsedAssets.Init(newAllUsedArray, newPerCategoryUsed, filtersToUse, previousUsedSortType, previousUsedSortOrder); buildInfo.UsedAssets.PopulateImportedSizes(); } } else { // no assets found. this only happens when we tried to move to next batch but it turns out to be the last // so we move back buildInfo.MoveUnusedAssetsBatchNumToPrev(); } BRT_BuildReportWindow.GetValueMessage = ""; buildInfo.FlagOkToRefresh(); } }
public static void RecategorizeAssetList(BuildInfo buildInfo) { buildInfo.RecategorizeAssetLists(); buildInfo.FlagOkToRefresh(); }
// ================================================================================================================================================================================================================== // main function for generating a report public static void GetValues(BuildInfo buildInfo, string[] scenesIncludedInProject, string buildFilePath, string projectAssetsPath, string editorAppContentsPath, bool calculateBuildSize) { BRT_BuildReportWindow.GetValueMessage = "Getting values..."; if (!DoesEditorLogHaveBuildInfo(_lastEditorLogPath)) { Debug.LogWarning(NO_BUILD_INFO_WARNING); return; } // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // determining build platform based on editor log // much more reliable especially when using an override log // if no build platform found from editor log, it will just use `buildInfo.BuildTargetUsed` string gotBuildType = GetBuildTypeFromEditorLog(_lastEditorLogPath); BuildPlatform buildPlatform = GetBuildPlatformFromString(gotBuildType, buildInfo.BuildTargetUsed); buildInfo.BuildType = gotBuildType; buildInfo.ProjectName = BuildReportTool.Util.GetProjectName(projectAssetsPath); // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // DLLs BRT_BuildReportWindow.GetValueMessage = "Getting list of DLLs..."; bool wasWebBuild = buildInfo.BuildType == "WebPlayer"; //Debug.Log("going to call parseDLLs"); ParseDLLs(_lastEditorLogPath, wasWebBuild, buildFilePath, projectAssetsPath, editorAppContentsPath, buildInfo.MonoLevel, buildInfo.CodeStrippingLevel, out buildInfo.MonoDLLs, out buildInfo.ScriptDLLs); Array.Sort(buildInfo.MonoDLLs, delegate(BuildReportTool.SizePart b1, BuildReportTool.SizePart b2) { if (b1.SizeBytes > b2.SizeBytes) return -1; if (b1.SizeBytes < b2.SizeBytes) return 1; return 0; }); Array.Sort(buildInfo.ScriptDLLs, delegate(BuildReportTool.SizePart b1, BuildReportTool.SizePart b2) { if (b1.SizeBytes > b2.SizeBytes) return -1; if (b1.SizeBytes < b2.SizeBytes) return 1; return 0; }); //Debug.Log("ParseDLLs done"); // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // build sizes per category BRT_BuildReportWindow.GetValueMessage = "Getting build sizes..."; //Debug.Log("ParseSizePartsFromString sta"); buildInfo.BuildSizes = ParseSizePartsFromString(_lastEditorLogPath); Array.Sort(buildInfo.BuildSizes, delegate(BuildReportTool.SizePart b1, BuildReportTool.SizePart b2) { if (b1.Percentage > b2.Percentage) return -1; else if (b1.Percentage < b2.Percentage) return 1; // if percentages are equal, check actual file size (approximate values) else if (b1.DerivedSize > b2.DerivedSize) return -1; else if (b1.DerivedSize < b2.DerivedSize) return 1; return 0; }); // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // getting project size (uncompressed) buildInfo.UsedTotalSize = ""; foreach (BuildReportTool.SizePart b in buildInfo.BuildSizes) { if (b.IsTotal) { buildInfo.UsedTotalSize = b.Size; break; } } // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // getting streaming assets size (uncompressed) if (calculateBuildSize) // BuildReportTool.Options.IncludeBuildSizeInReportCreation { buildInfo.StreamingAssetsSize = BuildReportTool.Util.GetFolderSizeReadable(projectAssetsPath + "/StreamingAssets"); } // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // getting compressed total build size BRT_BuildReportWindow.GetValueMessage = "Getting total build size..."; //Debug.Log("getting compressed total build size..."); //Debug.Log("trying to get size for: " + buildPlatform); //Debug.Log("trying to get size of: " + buildFilePath); buildInfo.TotalBuildSize = ""; if (calculateBuildSize) { if (buildPlatform == BuildPlatform.Flash) { // in Flash builds, `buildFilePath` is the .swf file buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath); } else if (buildPlatform == BuildPlatform.Android) { //Debug.Log("trying to get size of: " + buildFilePath); // in Unity 4, Android can generate an Eclipse project if set so in the build settings // or an .apk with an accompanying .obb file, which we should take into account // check if an .obb file was generated and get its file size if (!buildInfo.AndroidCreateProject && !buildInfo.AndroidUseAPKExpansionFiles) { // .apk without an .obb buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath); } else if (!buildInfo.AndroidCreateProject && buildInfo.AndroidUseAPKExpansionFiles) { // .apk with .obb // get the .apk file but remove the file type string obbPath = BuildReportTool.Util.ReplaceFileType(buildFilePath, ".main.obb"); double obbSize = BuildReportTool.Util.GetPathSizeInBytes(obbPath); double apkSize = BuildReportTool.Util.GetPathSizeInBytes(buildFilePath); buildInfo.TotalBuildSize = BuildReportTool.Util.GetBytesReadable(apkSize + obbSize); buildInfo.AndroidApkFileBuildSize = BuildReportTool.Util.GetBytesReadable(apkSize); buildInfo.AndroidObbFileBuildSize = BuildReportTool.Util.GetBytesReadable(obbSize); } else if (buildInfo.AndroidCreateProject) { // total build size is size of the eclipse project folder buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath); // if there is .obb, find it if (buildInfo.AndroidUseAPKExpansionFiles) { // the .obb is inside this folder buildInfo.AndroidObbFileBuildSize = BuildReportTool.Util.GetObbSizeInEclipseProjectReadable(buildFilePath); } } else { // ??? buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath); } } else if (buildPlatform == BuildPlatform.Web) { // in web builds, `buildFilePath` is the folder buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath); // find a .unity3d file inside the build folder and get its file size // compressed file size found in log is actually the .unity3d file size buildInfo.WebFileBuildSize = GetCompressedSizeReadingFromLog(); } else if ( buildPlatform == BuildPlatform.Windows32 || buildPlatform == BuildPlatform.Windows64 || buildPlatform == BuildPlatform.Linux32 || buildPlatform == BuildPlatform.Linux64) { // in windows builds, `buildFilePath` is the executable file // we additionaly need to get the size of the Data folder // in 32 bit builds, `buildFilePath` is the executable file (.x86 file). we still need the Data folder // in 64 bit builds, `buildFilePath` is the executable file (.x86_64 file). we still need the Data folder buildInfo.TotalBuildSize = BuildReportTool.Util.GetBytesReadable( GetStandaloneBuildSize(buildFilePath) ); } else if (buildPlatform == BuildPlatform.LinuxUniversal) { // in universal builds, `buildFilePath` is the 32-bit executable. we still need the 64-bit executable and the Data folder // gets the size of 32-bit executable and Data folder double exe32WithDataFolderSizeBytes = GetStandaloneBuildSize(buildFilePath); // get the .x86 file file but change the file type to ".x86_64" string exe64Path = BuildReportTool.Util.ReplaceFileType(buildFilePath, ".x86_64"); // gets the size of 64-bit executable double exe64SizeBytes = BuildReportTool.Util.GetPathSizeInBytes(exe64Path); buildInfo.TotalBuildSize = BuildReportTool.Util.GetBytesReadable(exe32WithDataFolderSizeBytes + exe64SizeBytes); } else if ( buildPlatform == BuildPlatform.MacOSX32 || buildPlatform == BuildPlatform.MacOSX64 || buildPlatform == BuildPlatform.MacOSXUniversal) { // in Mac builds, `buildFilePath` is the .app file (which is really just a folder) buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath); } else if (buildPlatform == BuildPlatform.iOS) { // in iOS builds, `buildFilePath` is the Xcode project folder buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath); } else { // in console builds, `buildFilePath` is ??? // last resort for unknown build platforms buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath); } } // for debug //GetCompressedSizeReadingFromLog(); // ensure this is not used anymore on new reports // (it's still there for old build report XML files) //buildInfo.CompressedBuildSize = ""; buildInfo.UnusedTotalSize = ""; // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // assets list if (buildInfo.UsedAssetsIncludedInCreation) { BRT_BuildReportWindow.GetValueMessage = "Getting list of used assets..."; // asset list buildInfo.FileFilters = BuildReportTool.FiltersUsed.GetProperFileFilterGroupToUse(_lastSavePath); List<BuildReportTool.SizePart> allUsed; allUsed = ParseAssetSizesFromEditorLog(_lastEditorLogPath, buildInfo.PrefabsUsedInScenes); if (scenesIncludedInProject != null) { string projectPath = BuildReportTool.Util.GetProjectPath(buildInfo.ProjectAssetsPath); for (int n = 0, len = scenesIncludedInProject.Length; n < len; ++n) { //Debug.Log("scene " + n + ": " + projectPath + scenesIncludedInProject[n]); allUsed.Add(BuildReportTool.Util.CreateSizePartFromFile(scenesIncludedInProject[n], projectPath + scenesIncludedInProject[n])); } } //Debug.Log("buildInfo.UsedAssets.All: " + buildInfo.UsedAssets.All.Length); if (buildInfo.UnusedAssetsIncludedInCreation) { BRT_BuildReportWindow.GetValueMessage = "Getting list of unused assets..."; BuildReportTool.SizePart[] allUnused; BuildReportTool.SizePart[][] perCategoryUnused; allUnused = GetAllUnusedAssets(scenesIncludedInProject, buildInfo.ScriptDLLs, projectAssetsPath, buildInfo.IncludedSvnInUnused, buildInfo.IncludedGitInUnused, buildPlatform, buildInfo.UnusedPrefabsIncludedInCreation, 0, buildInfo.UnusedAssetsEntriesPerBatch, allUsed); perCategoryUnused = SegregateAssetSizesPerCategory(allUnused, buildInfo.FileFilters); buildInfo.UnusedAssets = new AssetList(); buildInfo.UnusedAssets.Init(allUnused, perCategoryUnused, buildInfo.FileFilters); buildInfo.UnusedTotalSize = BuildReportTool.Util.GetBytesReadable( buildInfo.UnusedAssets.GetTotalSizeInBytes() ); } BuildReportTool.SizePart[] allUsedArray = allUsed.ToArray(); BuildReportTool.SizePart[][] perCategoryUsed = SegregateAssetSizesPerCategory(allUsedArray, buildInfo.FileFilters); buildInfo.UsedAssets = new AssetList(); buildInfo.UsedAssets.Init(allUsedArray, perCategoryUsed, buildInfo.FileFilters); } //foreach (string d in EditorUserBuildSettings.activeScriptCompilationDefines) //{ // Debug.Log("define: " + d); //} // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // duration of build generation System.TimeSpan timeNow = new System.TimeSpan(System.DateTime.Now.Ticks); buildInfo.ReportGenerationTime = timeNow - _timeReportGenerationStarted; BRT_BuildReportWindow.GetValueMessage = ""; buildInfo.FlagOkToRefresh(); }
static void RefreshUnusedAssetsBatch(BuildInfo buildInfo, FileFilterGroup filtersToUse) { if (buildInfo.UnusedAssetsIncludedInCreation) { BRT_BuildReportWindow.GetValueMessage = "Getting list of unused assets..."; List<BuildReportTool.SizePart> allUsed = buildInfo.UsedAssets.GetAllAsList(); BuildReportTool.SizePart[] allUnused; BuildReportTool.SizePart[][] perCategoryUnused; BuildPlatform buildPlatform = GetBuildPlatformFromString(buildInfo.BuildType, buildInfo.BuildTargetUsed); allUnused = GetAllUnusedAssets(buildInfo.ScenesIncludedInProject, buildInfo.ScriptDLLs, buildInfo.ProjectAssetsPath, buildInfo.IncludedSvnInUnused, buildInfo.IncludedGitInUnused, buildPlatform, buildInfo.UnusedPrefabsIncludedInCreation, buildInfo.UnusedAssetsBatchNum, buildInfo.UnusedAssetsEntriesPerBatch, allUsed); if (allUnused != null && allUnused.Length > 0) { perCategoryUnused = SegregateAssetSizesPerCategory(allUnused, filtersToUse); buildInfo.UnusedAssets = new AssetList(); buildInfo.UnusedAssets.Init(allUnused, perCategoryUnused, filtersToUse); if (allUsed.Count != buildInfo.UsedAssets.AllCount) { // it means GetAllUnusedAssets() found new used assets // re-assign all used and re-sort BuildReportTool.SizePart[] newAllUsedArray = allUsed.ToArray(); BuildReportTool.SizePart[][] newPerCategoryUsed = SegregateAssetSizesPerCategory(newAllUsedArray, filtersToUse); buildInfo.UsedAssets = new AssetList(); buildInfo.UsedAssets.Init(newAllUsedArray, newPerCategoryUsed, filtersToUse); } } else { buildInfo.MoveUnusedAssetsBatchNumToPrev(); } BRT_BuildReportWindow.GetValueMessage = ""; buildInfo.FlagOkToRefresh(); } }
public static void GetValues(BuildInfo buildInfo, string[] scenesIncludedInProject, string buildFilePath, string projectAssetsPath, string editorAppContentsPath) { BRT_BuildReportWindow.GetValueMessage = "Getting values..."; string gotBuildType = GetBuildTypeFromEditorLog(_lastEditorLogPath); if (string.IsNullOrEmpty(gotBuildType)) { Debug.LogWarning(NO_BUILD_INFO_WARNING); return; } // determining build platform based on editor log // much more reliable especially when using an override log BuildPlatform buildPlatform = GetBuildPlatformFromString(gotBuildType, buildInfo.BuildTargetUsed); buildInfo.BuildType = gotBuildType; buildInfo.ProjectName = BuildReportTool.Util.GetProjectName(projectAssetsPath); // DLLs BRT_BuildReportWindow.GetValueMessage = "Getting list of DLLs..."; bool wasWebBuild = buildInfo.BuildType == "WebPlayer"; //Debug.Log("going to call parseDLLs"); ParseDLLs(_lastEditorLogPath, wasWebBuild, buildFilePath, projectAssetsPath, editorAppContentsPath, buildInfo.MonoLevel, buildInfo.CodeStrippingLevel, out buildInfo.MonoDLLs, out buildInfo.ScriptDLLs); Array.Sort(buildInfo.MonoDLLs, delegate(BuildReportTool.SizePart b1, BuildReportTool.SizePart b2) { if (b1.SizeBytes > b2.SizeBytes) return -1; if (b1.SizeBytes < b2.SizeBytes) return 1; return 0; }); Array.Sort(buildInfo.ScriptDLLs, delegate(BuildReportTool.SizePart b1, BuildReportTool.SizePart b2) { if (b1.SizeBytes > b2.SizeBytes) return -1; if (b1.SizeBytes < b2.SizeBytes) return 1; return 0; }); //Debug.Log("ParseDLLs done"); // build sizes per category BRT_BuildReportWindow.GetValueMessage = "Getting build sizes..."; //Debug.Log("ParseSizePartsFromString sta"); buildInfo.BuildSizes = ParseSizePartsFromString(_lastEditorLogPath); Array.Sort(buildInfo.BuildSizes, delegate(BuildReportTool.SizePart b1, BuildReportTool.SizePart b2) { if (b1.Percentage > b2.Percentage) return -1; else if (b1.Percentage < b2.Percentage) return 1; // if percentages are equal, check actual file size (approximate values) else if (b1.DerivedSize > b2.DerivedSize) return -1; else if (b1.DerivedSize < b2.DerivedSize) return 1; return 0; }); // getting total build size (uncompressed) buildInfo.TotalBuildSize = ""; foreach (BuildReportTool.SizePart b in buildInfo.BuildSizes) { if (b.IsTotal) { buildInfo.TotalBuildSize = b.Size; } } // getting compressed total build size buildInfo.CompressedBuildSize = ""; const string COMPRESSED_BUILD_SIZE_KEY = "Total compressed size "; foreach (string line in DldUtil.BigFileReader.ReadFile(_lastEditorLogPath, COMPRESSED_BUILD_SIZE_KEY)) { int compressedBuildSizeIdx = line.LastIndexOf(COMPRESSED_BUILD_SIZE_KEY); if (compressedBuildSizeIdx != -1) { // this data in the editor log only shows in web builds so far // meaning we do not get a compressed result in other builds (except android) // int compressedBuildSizeEndIdx = line.IndexOf(". Total uncompressed size ", compressedBuildSizeIdx); buildInfo.CompressedBuildSize = line.Substring(compressedBuildSizeIdx+COMPRESSED_BUILD_SIZE_KEY.Length, compressedBuildSizeEndIdx - compressedBuildSizeIdx - COMPRESSED_BUILD_SIZE_KEY.Length); //Debug.Log("compressed: " + buildInfo.CompressedBuildSize); } // for getting Android/Flash compressed build size else if (buildPlatform == BuildPlatform.Flash || buildPlatform == BuildPlatform.Android) { buildInfo.CompressedBuildSize = BuildReportTool.Util.GetFileSizeReadable(buildFilePath); } break; } if (buildInfo.UsedAssetsIncludedInCreation) { BRT_BuildReportWindow.GetValueMessage = "Getting list of used assets..."; // asset list buildInfo.FileFilters = BuildReportTool.FiltersUsed.GetProperFileFilterGroupToUse(_lastSavePath); List<BuildReportTool.SizePart> allUsed; BuildReportTool.SizePart[][] perCategoryUsed; allUsed = ParseAssetSizesFromEditorLog(_lastEditorLogPath, buildInfo.PrefabsUsedInScenes); //Debug.Log("buildInfo.UsedAssets.All: " + buildInfo.UsedAssets.All.Length); if (buildInfo.UnusedAssetsIncludedInCreation) { BRT_BuildReportWindow.GetValueMessage = "Getting list of unused assets..."; BuildReportTool.SizePart[] allUnused; BuildReportTool.SizePart[][] perCategoryUnused; allUnused = GetAllUnusedAssets(scenesIncludedInProject, buildInfo.ScriptDLLs, projectAssetsPath, buildInfo.IncludedSvnInUnused, buildInfo.IncludedGitInUnused, buildPlatform, buildInfo.UnusedPrefabsIncludedInCreation, 0, buildInfo.UnusedAssetsEntriesPerBatch, allUsed); perCategoryUnused = SegregateAssetSizesPerCategory(allUnused, buildInfo.FileFilters); buildInfo.UnusedAssets = new AssetList(); buildInfo.UnusedAssets.Init(allUnused, perCategoryUnused, buildInfo.FileFilters); } BuildReportTool.SizePart[] allUsedArray = allUsed.ToArray(); perCategoryUsed = SegregateAssetSizesPerCategory(allUsedArray, buildInfo.FileFilters); buildInfo.UsedAssets = new AssetList(); buildInfo.UsedAssets.Init(allUsedArray, perCategoryUsed, buildInfo.FileFilters); } //foreach (string d in EditorUserBuildSettings.activeScriptCompilationDefines) //{ // Debug.Log("define: " + d); //} BRT_BuildReportWindow.GetValueMessage = ""; buildInfo.FlagOkToRefresh(); }