Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

AssetPreview.GetMiniThumbnail

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

Declaration

public static Texture2D GetMiniThumbnail(Object obj);

Parameters

Parameter Description
obj The object instance to return an icon for.

Returns

Texture2D A 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.

Description

Obtains a small icon for a specific object instance.

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.