GetAssetPreview(Object)
Returns a rendered preview texture for an asset. This is the large image shown in the Project window grid view.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
public static Texture2D GetAssetPreview(Object asset)
Parameters
The object to get a preview texture for.
Returns
Type | Description |
|---|---|
| Texture2D | A rendered preview texture for the given asset, or null if the preview is not yet ready. |
Remarks
The preview is rendered on demand and loaded asynchronously, so this might return null until the preview is ready. Poll AssetPreview.IsLoadingAssetPreview and repaint when it finishes. Previews reflect the asset's real appearance (for example a material rendered on a sphere, or a texture with correct color interpretation), so unlike AssetPreview.GetMiniThumbnail a normal map or other non-color texture displays correctly. For an efficient, always-available icon instead of a rendered preview, see AssetDatabase.GetCachedIcon.