Specifies the source type for Android adaptive icon layers.
Use this property to choose between per-DPI image textures (AndroidIconSourceType.Image) and resolution-independent Android Vector Drawable XML files (AndroidIconSourceType.VectorDrawable) for adaptive icon layers.
When set to AndroidIconSourceType.Image, configure the icon textures using PlayerSettings.SetPlatformIcons.
When set to AndroidIconSourceType.VectorDrawable, assign Android Vector Drawable XML files using PlayerSettings.Android.adaptiveIconVectorDrawableBackground, PlayerSettings.Android.adaptiveIconVectorDrawableForeground, and PlayerSettings.Android.adaptiveIconVectorDrawableMonochrome.
For Android TV banner icons, use PlayerSettings.Android.adaptiveBannerVectorDrawableBackground and PlayerSettings.Android.adaptiveBannerVectorDrawableForeground. Banner icons require PlayerSettings.Android.androidTVCompatibility and PlayerSettings.Android.androidBannerEnabled to be enabled.
Additional resources: AndroidIconSourceType.
using UnityEngine; using UnityEditor;
public class IconSourceTypeSample : MonoBehaviour { [MenuItem("Build/Set Vector Drawable Icons")] public static void SetVectorDrawableIcons() { // Set adaptive icon source type to VectorDrawable PlayerSettings.Android.iconSourceType = AndroidIconSourceType.VectorDrawable;
// Load Vector Drawable XML files imported as TextAssets var background = AssetDatabase.LoadAssetAtPath<TextAsset>("Assets/Icons/ic_launcher_background.xml"); var foreground = AssetDatabase.LoadAssetAtPath<TextAsset>("Assets/Icons/ic_launcher_foreground.xml"); var monochrome = AssetDatabase.LoadAssetAtPath<TextAsset>("Assets/Icons/ic_launcher_monochrome.xml");
// Assign Vector Drawable assets to each adaptive icon layer PlayerSettings.Android.adaptiveIconVectorDrawableBackground = background; PlayerSettings.Android.adaptiveIconVectorDrawableForeground = foreground; PlayerSettings.Android.adaptiveIconVectorDrawableMonochrome = monochrome;
// For Android TV banner icons, enable TV compatibility and banner PlayerSettings.Android.androidTVCompatibility = true; PlayerSettings.Android.androidBannerEnabled = true;
var bannerBg = AssetDatabase.LoadAssetAtPath<TextAsset>("Assets/Icons/banner_background.xml"); var bannerFg = AssetDatabase.LoadAssetAtPath<TextAsset>("Assets/Icons/banner_foreground.xml"); PlayerSettings.Android.adaptiveBannerVectorDrawableBackground = bannerBg; PlayerSettings.Android.adaptiveBannerVectorDrawableForeground = bannerFg; } }