Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

AssetPreview

class in UnityEditor

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

Utility for fetching asset previews by instance ID of assets, See AssetPreview.GetAssetPreview. Since previews are loaded asynchronously methods are provided for requesting if all previews have been fully loaded, see AssetPreview.IsLoadingAssetPreviews. Loaded previews are stored in a cache, the size of the cache can be controlled by calling [AssetPreview.SetPreviewTextureCacheSize].

You can use the methods in this class in the following ways: - For a rendered preview use AssetPreview.GetAssetPreview. - For a small per-object icon use AssetPreview.GetMiniThumbnail (note: a Texture2D returns the full-size texture, not a thumbnail). - For a generic type icon use AssetPreview.GetMiniTypeThumbnail. - For an optimized, path-based icon useAssetDatabase.GetCachedIcon.

Static Methods

Method Description
GetAssetPreviewReturns a rendered preview texture for an asset. This is the large image shown in the Project window grid view.
GetMiniThumbnailObtains a small icon for a specific object instance.
GetMiniTypeThumbnailObtains the generic icon for the given type.
IsLoadingAssetPreviewChecks whether the preview for a specific asset is still loading. Previews load asynchronously, so poll this and repaint when it finishes.
IsLoadingAssetPreviewsChecks whether any requested previews are still loading. Previews load asynchronously, so poll this and repaint when they finish.
SetPreviewTextureCacheSizeSet the asset preview cache to a size that can hold all visible previews on the screen at once.