C# Class UnityEditor.AssetPreview

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].

显示文件 Open project: CarlosHBC/UnityDecompiled Class Usage Examples

Public Methods

Method Description
GetAssetPreview ( Object asset ) : Texture2D

Returns a preview texture for an asset.

GetMiniTypeThumbnail ( Type type ) : Texture2D

Returns the thumbnail for the type.

IsLoadingAssetPreview ( int instanceID ) : bool

Loading previews is asynchronous so it is useful to know if a specific asset preview is in the process of being loaded so client code e.g can repaint while waiting for the loading to finish.

IsLoadingAssetPreviews ( ) : bool

Loading previews is asynchronous so it is useful to know if any requested previews are in the process of being loaded so client code e.g can repaint while waiting.

SetPreviewTextureCacheSize ( int size ) : void

Set the asset preview cache to a size that can hold all visible previews on the screen at once.

Private Methods

Method Description
ClearTemporaryAssetPreviews ( ) : void
DeletePreviewTextureManagerByID ( int clientID ) : void
GetAssetPreview ( int instanceID ) : Texture2D
GetAssetPreview ( int instanceID, int clientID ) : Texture2D
GetMiniThumbnail ( Object obj ) : Texture2D
GetMiniTypeThumbnail ( Object obj ) : Texture2D
GetMiniTypeThumbnailFromClassID ( int classID ) : Texture2D
HasAnyNewPreviewTexturesAvailable ( ) : bool
HasAnyNewPreviewTexturesAvailable ( int clientID ) : bool
INTERNAL_GetMiniTypeThumbnailFromObject ( Object monoObj ) : Texture2D
INTERNAL_GetMiniTypeThumbnailFromType ( Type managedType ) : Texture2D
IsLoadingAssetPreview ( int instanceID, int clientID ) : bool
IsLoadingAssetPreviews ( int clientID ) : bool
SetPreviewTextureCacheSize ( int size, int clientID ) : void

Method Details

GetAssetPreview() public static method

Returns a preview texture for an asset.

public static GetAssetPreview ( Object asset ) : Texture2D
asset Object
return UnityEngine.Texture2D

GetMiniTypeThumbnail() public static method

Returns the thumbnail for the type.

public static GetMiniTypeThumbnail ( Type type ) : Texture2D
type System.Type
return UnityEngine.Texture2D

IsLoadingAssetPreview() public static method

Loading previews is asynchronous so it is useful to know if a specific asset preview is in the process of being loaded so client code e.g can repaint while waiting for the loading to finish.

public static IsLoadingAssetPreview ( int instanceID ) : bool
instanceID int InstanceID of the assset that a preview has been requested for by: AssetPreview.GetAssetPreview().
return bool

IsLoadingAssetPreviews() public static method

Loading previews is asynchronous so it is useful to know if any requested previews are in the process of being loaded so client code e.g can repaint while waiting.

public static IsLoadingAssetPreviews ( ) : bool
return bool

SetPreviewTextureCacheSize() public static method

Set the asset preview cache to a size that can hold all visible previews on the screen at once.

public static SetPreviewTextureCacheSize ( int size ) : void
size int The number of previews that can be loaded into the cache before the least used previews are being unloaded.
return void