Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

IconDensity

enumeration

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

Description

Identifies the screen density an Android launcher icon is drawn for.

Android keeps one icon per density and picks the closest match for the device. The values are ordered from the lowest density to the highest, and each maps to the mipmap resource folder suffix of the same name. Use them with Icons.GetIcon to read or set a single density.

Additional resources: Icons, AdaptiveIcons

Assign a localized icon for one density.

using Unity.Localization;
using Android = Unity.Localization.Android;

namespace Unity.Localization.Samples { public class AndroidIconsExample { // Every density has to be assigned, or the locale keeps the icons from the Player Settings. static readonly (Android.IconDensity density, string key)[] k_Icons = { (Android.IconDensity.Low, "Launcher Icon ldpi"), (Android.IconDensity.Medium, "Launcher Icon mdpi"), (Android.IconDensity.High, "Launcher Icon hdpi"), (Android.IconDensity.ExtraHigh, "Launcher Icon xhdpi"), (Android.IconDensity.ExtraExtraHigh, "Launcher Icon xxhdpi"), (Android.IconDensity.ExtraExtraExtraHigh, "Launcher Icon xxxhdpi") };

public void Run(Android.AppInfo appInfo) { foreach (var (density, key) in k_Icons) appInfo.LegacyIcons.GetIcon(density).SetReference("App Icons", key); } } }

Properties

Property Description
Low Low density screens, the mipmap-ldpi qualifier.
Medium Medium density screens, the mipmap-mdpi qualifier.
High High density screens, the mipmap-hdpi qualifier.
ExtraHigh Extra high density screens, the mipmap-xhdpi qualifier.
ExtraExtraHigh Twice extra high density screens, the mipmap-xxhdpi qualifier.
ExtraExtraExtraHigh Three times extra high density screens, the mipmap-xxxhdpi qualifier.