Exemple #1
0
        private void SetIconSettings(BuildTargetGroup buildTargetGroup)
        {
            if (iconFolder == null)
            {
                return;
            }

            // プラットフォームのアイコンサイズを取得。
            var iconSizes = PlayerSettings.GetIconSizesForTargetGroup(buildTargetGroup);

            var icons = new Texture2D[iconSizes.Length];

            var folderPath   = AssetDatabase.GetAssetPath(iconFolder);
            var iconTextures = UnityEditorUtility.LoadAssetsInFolder <Texture2D>(folderPath);

            for (var i = 0; i < iconSizes.Length; i++)
            {
                var size = iconSizes[i];

                Texture2D texture = null;

                foreach (var iconTexture in iconTextures)
                {
                    var assetPath = AssetDatabase.GetAssetPath(iconTexture);

                    var assetName = Path.GetFileName(assetPath);

                    // icon_72x72.png.
                    if (assetName.Contains(string.Format("{0}x{1}", size, size)))
                    {
                        texture = iconTexture;
                        break;
                    }
                }

                icons[i] = texture;
            }

            PlayerSettings.SetIconsForTargetGroup(buildTargetGroup, icons);
        }