Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetMiniThumbnail(Object)

Obtains a small icon for a specific object instance.
Read time 1 minuteLast updated 12 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
public static Texture2D GetMiniThumbnail(Object obj)

Parameters

The object instance to return an icon for.

Returns

Type

Description

Texture2DA custom icon if the passed object has one, otherwise a fallback icon for its type. If the object is a Texture2D, then it is treated as its own thumbnail, and the full size texture including channel packing is returned.

Remarks

This resolves the most specific image available for the instance. Objects with a custom icon such as GameObjects, prefabs by type, MonoBehaviour and ScriptableObject scripts via a picked icon or the Icon attribute, lights by type, or material variants return that icon. A Texture2D is a special case: it returns the texture itself at full size, including any channel packing, so normal maps and other non-color textures appear with incorrect colors.
The image returned isn't the image displayed in the Project window (which uses AssetDatabase.GetCachedIcon and AssetPreview.GetAssetPreview). For a correct, icon-sized texture image, use AssetDatabase.GetCachedIcon, which is synchronous and always available. For a large, rendered preview, use AssetPreview.GetAssetPreview, which is loaded asynchronously and returns null until rendering finishes. For a plain type icon that never returns instance pixels use AssetPreview.GetMiniTypeThumbnail.