예제 #1
0
        public static void CreateForAllAssets(AssetDependencies data, BuildReportTool.BuildInfo buildInfo, bool debugLog = false)
        {
            if (buildInfo == null)
            {
                return;
            }

            var startingOpenSet = new Queue <string>();

            if (buildInfo.UsedAssets != null && buildInfo.UsedAssets.All != null)
            {
                var allUsedAssets = buildInfo.UsedAssets.All;
                for (int n = 0, len = allUsedAssets.Length; n < len; ++n)
                {
                    startingOpenSet.Enqueue(allUsedAssets[n].Name);
                }
            }

            if (buildInfo.UnusedAssets != null && buildInfo.UnusedAssets.All != null)
            {
                var allUnusedAssets = buildInfo.UnusedAssets.All;
                for (int n = 0, len = allUnusedAssets.Length; n < len; ++n)
                {
                    startingOpenSet.Enqueue(allUnusedAssets[n].Name);
                }
            }

            Create(data, startingOpenSet, debugLog);
        }
예제 #2
0
        void DrawBuildSizes(BuildReportTool.BuildInfo buildReportToDisplay)
        {
            if (_hasCompressedBuildSize)
            {
                GUILayout.BeginVertical();
            }

            GUILayout.Label(Labels.TOTAL_SIZE_BREAKDOWN_LABEL, BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);

            if (_hasCompressedBuildSize)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label(Labels.TOTAL_SIZE_BREAKDOWN_MSG_PRE_BOLD,
                                BuildReportTool.Window.Settings.INFO_SUBTITLE_STYLE_NAME);
                GUILayout.Label(Labels.TOTAL_SIZE_BREAKDOWN_MSG_BOLD,
                                BuildReportTool.Window.Settings.INFO_SUBTITLE_BOLD_STYLE_NAME);
                GUILayout.Label(Labels.TOTAL_SIZE_BREAKDOWN_MSG_POST_BOLD,
                                BuildReportTool.Window.Settings.INFO_SUBTITLE_STYLE_NAME);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                GUILayout.EndVertical();
            }

            if (_hasBuildSizes)
            {
                GUILayout.BeginHorizontal(GUILayout.MaxWidth(500));

                DrawNames(buildReportToDisplay.BuildSizes);
                DrawReadableSizes(buildReportToDisplay.BuildSizes);
                DrawPercentages(buildReportToDisplay.BuildSizes);

                GUILayout.EndHorizontal();
            }
        }
예제 #3
0
        void DrawAuxiliaryBuildSizes(BuildReportTool.BuildInfo buildReportToDisplay)
        {
            BuildReportTool.BuildPlatform buildPlatform =
                BuildReportTool.ReportGenerator.GetBuildPlatformFromString(buildReportToDisplay.BuildType,
                                                                           buildReportToDisplay.BuildTargetUsed);

            if (buildPlatform == BuildReportTool.BuildPlatform.Web)
            {
                GUILayout.Space(20);
                GUILayout.BeginVertical();
                GUILayout.Label(Labels.WEB_UNITY3D_FILE_SIZE_LABEL,
                                BuildReportTool.Window.Settings.INFO_SUBTITLE_BOLD_STYLE_NAME);
                GUILayout.Label(buildReportToDisplay.WebFileBuildSize,
                                BuildReportTool.Window.Settings.BIG_NUMBER_STYLE_NAME);
                GUILayout.EndVertical();
            }
            else if (buildPlatform == BuildReportTool.BuildPlatform.Android)
            {
                if (!buildReportToDisplay.AndroidCreateProject && buildReportToDisplay.AndroidUseAPKExpansionFiles)
                {
                    GUILayout.Space(20);
                    GUILayout.BeginVertical();
                    GUILayout.Label(Labels.ANDROID_APK_FILE_SIZE_LABEL,
                                    BuildReportTool.Window.Settings.INFO_SUBTITLE_BOLD_STYLE_NAME);
                    GUILayout.Label(buildReportToDisplay.AndroidApkFileBuildSize,
                                    BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
                    GUILayout.EndVertical();

                    GUILayout.Space(20);
                    GUILayout.BeginVertical();
                    GUILayout.Label(Labels.ANDROID_OBB_FILE_SIZE_LABEL,
                                    BuildReportTool.Window.Settings.INFO_SUBTITLE_BOLD_STYLE_NAME);
                    GUILayout.Label(buildReportToDisplay.AndroidObbFileBuildSize,
                                    BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
                    GUILayout.EndVertical();
                }
                else if (buildReportToDisplay.AndroidCreateProject && buildReportToDisplay.AndroidUseAPKExpansionFiles)
                {
                    GUILayout.Space(20);
                    GUILayout.BeginVertical();
                    GUILayout.Label(Labels.ANDROID_OBB_FILE_SIZE_LABEL,
                                    BuildReportTool.Window.Settings.INFO_SUBTITLE_BOLD_STYLE_NAME);
                    GUILayout.Label(buildReportToDisplay.AndroidObbFileBuildSize,
                                    BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
                    GUILayout.EndVertical();
                }
            }

            // Streaming Assets
            if (buildReportToDisplay.HasStreamingAssets)
            {
                GUILayout.Space(20);
                BuildReportTool.Window.Utility.DrawLargeSizeDisplay(Labels.STREAMING_ASSETS_TOTAL_SIZE_LABEL,
                                                                    Labels.STREAMING_ASSETS_SIZE_DESC, buildReportToDisplay.StreamingAssetsSize);
            }
        }
예제 #4
0
        void DrawDLLList(BuildReportTool.BuildInfo buildReportToDisplay)
        {
            BuildReportTool.BuildPlatform buildPlatform =
                BuildReportTool.ReportGenerator.GetBuildPlatformFromString(buildReportToDisplay.BuildType,
                                                                           buildReportToDisplay.BuildTargetUsed);

            GUILayout.BeginHorizontal();

            // column 1
            GUILayout.BeginVertical();
            if (_hasMonoDLLsToDisplay)
            {
                GUILayout.Label(Labels.MONO_DLLS_LABEL, BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
                {
                    GUILayout.BeginHorizontal(GUILayout.MaxWidth(500));
                    DrawNames(buildReportToDisplay.MonoDLLs);
                    DrawReadableSizes(buildReportToDisplay.MonoDLLs);
                    GUILayout.EndHorizontal();
                }

                GUILayout.Space(20);
            }

            if (_hasUnityEngineDLLsToDisplay)
            {
                DrawScriptDLLsList(buildReportToDisplay, buildPlatform);
            }

            GUILayout.EndVertical();

            GUILayout.Space(15);

            // column 2
            GUILayout.BeginVertical();
            if (_hasUnityEngineDLLsToDisplay)
            {
                GUILayout.Label(Labels.UNITY_ENGINE_DLLS_LABEL, BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
                {
                    GUILayout.BeginHorizontal(GUILayout.MaxWidth(500));
                    DrawNames(buildReportToDisplay.UnityEngineDLLs);
                    DrawReadableSizes(buildReportToDisplay.UnityEngineDLLs);
                    GUILayout.EndHorizontal();
                }
            }
            else
            {
                DrawScriptDLLsList(buildReportToDisplay, buildPlatform);
            }

            GUILayout.Space(20);
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();
        }
예제 #5
0
        public override void DrawGUI(Rect position, BuildReportTool.BuildInfo buildReportToDisplay,
                                     AssetDependencies assetDependencies, out bool requestRepaint)
        {
            requestRepaint = false;

            if (Event.current.type == EventType.Layout)
            {
                _hasTotalBuildSize = !string.IsNullOrEmpty(buildReportToDisplay.TotalBuildSize) &&
                                     !string.IsNullOrEmpty(buildReportToDisplay.BuildFilePath);

                _hasUsedAssetsTotalSize = !string.IsNullOrEmpty(buildReportToDisplay.UsedTotalSize);
                _hasCompressedBuildSize = !string.IsNullOrEmpty(buildReportToDisplay.CompressedBuildSize);
                _hasBuildSizes          = buildReportToDisplay.BuildSizes != null;
                _hasMonoDLLsToDisplay   = buildReportToDisplay.MonoDLLs != null && buildReportToDisplay.MonoDLLs.Length > 0;

                _hasUnityEngineDLLsToDisplay = buildReportToDisplay.UnityEngineDLLs != null &&
                                               buildReportToDisplay.UnityEngineDLLs.Length > 0;

                _hasScriptDLLsToDisplay =
                    buildReportToDisplay.ScriptDLLs != null && buildReportToDisplay.ScriptDLLs.Length > 0;
            }


            GUILayout.Space(2);             // top padding for scrollbar

            _assetListScrollPos = GUILayout.BeginScrollView(_assetListScrollPos);

            GUILayout.Space(10);             // top padding for content

            GUILayout.BeginHorizontal();
            GUILayout.Space(10);             // extra left padding

            DrawTotalSize(buildReportToDisplay);

            GUILayout.Space(BuildReportTool.Window.Settings.CATEGORY_HORIZONTAL_SPACING);
            GUILayout.BeginVertical();

            DrawBuildSizes(buildReportToDisplay);

            GUILayout.Space(BuildReportTool.Window.Settings.CATEGORY_VERTICAL_SPACING);

            DrawDLLList(buildReportToDisplay);

            GUILayout.EndVertical();
            GUILayout.Space(20);             // extra right padding
            GUILayout.EndHorizontal();

            GUILayout.EndScrollView();
        }
        void DrawScriptDLLsList(BuildReportTool.BuildInfo buildReportToDisplay, BuildReportTool.BuildPlatform buildPlatform)
        {
            if (!_hasScriptDLLsToDisplay)
            {
                return;
            }

            GUILayout.Label(Labels.SCRIPT_DLLS_LABEL, BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
            {
                GUILayout.BeginHorizontal(GUILayout.MaxWidth(500));
                DrawNames(buildReportToDisplay.ScriptDLLs);
                DrawReadableSizes(buildReportToDisplay.ScriptDLLs);
                GUILayout.EndHorizontal();
            }
        }
예제 #7
0
        public static void CreateForUsedAssetsOnly(AssetDependencies data, BuildReportTool.BuildInfo buildInfo,
                                                   bool debugLog = false)
        {
            if (buildInfo == null)
            {
                return;
            }

            var startingOpenSet = new Queue <string>();

            // we'll start with the scenes to be included in the build:
            var scenes = buildInfo.ScenesInBuild;

            if (scenes != null)
            {
                for (int n = 0, len = scenes.Length; n < len; ++n)
                {
                    if (scenes[n].Enabled && !string.IsNullOrEmpty(scenes[n].Path))
                    {
                        startingOpenSet.Enqueue(scenes[n].Path);
                    }
                }
            }

            // plus all Resources assets (since they are not referred
            // to in any scenes, we have to add them explicitly)
            if (buildInfo.UsedAssets != null && buildInfo.UsedAssets.All != null)
            {
                var allUsedAssets = buildInfo.UsedAssets.All;
                for (int n = 0, len = allUsedAssets.Length; n < len; ++n)
                {
                    if (!string.IsNullOrEmpty(allUsedAssets[n].Name) &&
                        allUsedAssets[n].Name.IndexOf("/Resources/", StringComparison.OrdinalIgnoreCase) > -1)
                    {
                        startingOpenSet.Enqueue(allUsedAssets[n].Name);
                    }
                }
            }

            Create(data, startingOpenSet, debugLog);
        }
예제 #8
0
        public static void CreateForUsedAssetsOnly(TextureData data, BuildReportTool.BuildInfo buildInfo, bool debugLog = false)
        {
            if (buildInfo == null)
            {
                if (debugLog)
                {
                    Debug.LogError("Can't create TextureData for Used Assets, BuildInfo is null");
                }
                return;
            }
            if (debugLog)
            {
                Debug.Log("Will create TextureData for Used Assets");
            }

            BuildReportTool.BuildPlatform buildPlatform = BuildReportTool.ReportGenerator.GetBuildPlatformFromString(buildInfo.BuildType, buildInfo.BuildTargetUsed);

            var textureDataEntries = data.GetTextureData();

            textureDataEntries.Clear();

            AppendTextureData(data, buildPlatform, buildInfo.UsedAssets.All, false, debugLog);
        }
예제 #9
0
        void DrawTotalSize(BuildReportTool.BuildInfo buildReportToDisplay)
        {
            GUILayout.BeginVertical();


            if (buildReportToDisplay.HasOldSizeValues)
            {
                // in old sizes:
                // TotalBuildSize is really the used assets size
                // CompressedBuildSize if present is the total build size

                BuildReportTool.Window.Utility.DrawLargeSizeDisplay(Labels.USED_TOTAL_SIZE_LABEL,
                                                                    Labels.USED_TOTAL_SIZE_DESC, buildReportToDisplay.TotalBuildSize);
                GUILayout.Space(40);
                BuildReportTool.Window.Utility.DrawLargeSizeDisplay(Labels.BUILD_TOTAL_SIZE_LABEL,
                                                                    BuildReportTool.Window.Utility.GetProperBuildSizeDesc(buildReportToDisplay),
                                                                    buildReportToDisplay.CompressedBuildSize);
            }
            else
            {
                // Total Build Size
                if (_hasTotalBuildSize)
                {
                    GUILayout.BeginVertical();

                    var buildPlatform =
                        BuildReportTool.ReportGenerator.GetBuildPlatformFromString(buildReportToDisplay.BuildType,
                                                                                   buildReportToDisplay.BuildTargetUsed);

                    GUILayout.Label(
                        buildPlatform == BuildPlatform.iOS ? Labels.BUILD_XCODE_SIZE_LABEL : Labels.BUILD_TOTAL_SIZE_LABEL,
                        BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);

                    GUILayout.Label(BuildReportTool.Util.GetBuildSizePathDescription(buildReportToDisplay),
                                    BuildReportTool.Window.Settings.TINY_HELP_STYLE_NAME);

                    GUILayout.Label(buildReportToDisplay.TotalBuildSize,
                                    BuildReportTool.Window.Settings.BIG_NUMBER_STYLE_NAME);
                    GUILayout.EndVertical();

                    DrawAuxiliaryBuildSizes(buildReportToDisplay);
                    GUILayout.Space(40);
                }


                // Used Assets
                if (_hasUsedAssetsTotalSize)
                {
                    BuildReportTool.Window.Utility.DrawLargeSizeDisplay(Labels.USED_TOTAL_SIZE_LABEL,
                                                                        Labels.USED_TOTAL_SIZE_DESC, buildReportToDisplay.UsedTotalSize);
                    GUILayout.Space(40);
                }


                // Unused Assets
                if (buildReportToDisplay.UnusedAssetsIncludedInCreation)
                {
                    BuildReportTool.Window.Utility.DrawLargeSizeDisplay(Labels.UNUSED_TOTAL_SIZE_LABEL,
                                                                        Labels.UNUSED_TOTAL_SIZE_DESC, buildReportToDisplay.UnusedTotalSize);
                }
            }

            GUILayout.EndVertical();
        }
예제 #10
0
 public override void RefreshData(BuildReportTool.BuildInfo buildReport)
 {
 }