Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

PlayerSettings.Android.iconSourceType

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public static AndroidIconSourceType iconSourceType;

Description

Specifies the source type for Android adaptive icon layers.

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; } }