GetAssetPreview(Object)
Returns a rendered preview texture for an asset. This is the large image shown in the Project window grid view.
阅读时间1 分钟最后更新于 1 个月前
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor
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.