示例#1
0
        internal void AddPlatformSpecificAssets()
        {
            int counter = 0;
            int countTo = Enum.GetValues(typeof(BuildTargetGroup)).Length;

            //TODO Get all the different splash screens and config files somehow
            List <UnityEngine.Object> splash = new List <UnityEngine.Object>();

#if UNITY_5_5_OR_NEWER
            //Dont add splashscreen in this version
#else
            splash.Add(UnityEditor.PlayerSettings.xboxSplashScreen);
#endif
            //Loop the entries
            foreach (UnityEngine.Object obj in splash)
            {
                //Early out if it already exist
                if (obj == null || m_BuildSizeList.Exists(val => val.Path == AssetDatabase.GetAssetPath(obj)))
                {
                    continue;
                }

                BuildReportAsset newAsset = new BuildReportAsset();

                newAsset.SetAssetInfo(obj, AssetDatabase.GetAssetPath(obj));
                //newAsset.SetSize(0.0f, "--");
                m_BuildSizeList.Add(newAsset);
            }

            //Loop icons in buildtargetgroups
            foreach (BuildTargetGroup btg in (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup)))
            {
                EditorUtility.DisplayProgressBar(
                    "Add Target Specifics for " + btg.ToString(),
                    "Looking at icons and splash screens for targetgroups",
                    (float)counter / (float)countTo);

                Texture2D[] buildTargetGroupTextures = UnityEditor.PlayerSettings.GetIconsForTargetGroup(btg);

                foreach (Texture2D curIcon in buildTargetGroupTextures)
                {
                    //Early out if it already exist
                    if (curIcon == null || m_BuildSizeList.Exists(val => val.Path == AssetDatabase.GetAssetPath(curIcon)))
                    {
                        continue;
                    }

                    BuildReportAsset newAsset = new BuildReportAsset();

                    newAsset.SetAssetInfo(curIcon, AssetDatabase.GetAssetPath(curIcon));
                    //newAsset.SetSize(0.0f, "--");
                    m_BuildSizeList.Add(newAsset);
                }
                AHHelper.UnloadUnused();
            }

            EditorUtility.ClearProgressBar();
        }
示例#2
0
        internal void SetAssetInfo(UnityEngine.Object obj, string path)
        {
            long fileSize;

#if UNITY_2017_1_OR_NEWER
            fileSize = Profiler.GetRuntimeMemorySizeLong(obj);
#else
            fileSize = Profiler.GetRuntimeMemorySize(obj);
#endif
            SetSize(fileSize);

            this.m_path = path;
            //string[] parts = path.Split('/');
            this.m_name = obj.name;// parts[parts.Length - 1];

            m_assetGUID = UnityEditor.AssetDatabase.AssetPathToGUID(path);
            m_type      = new AHSerializableSystemType(obj.GetType());

            AHHelper.UnloadUnused();
        }