Skip to main content

Class ShowAssetPreviewAttribute

Displays a preview image of the referenced asset in the Inspector.

[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ShowAssetPreviewAttribute : PropertyAttribute

Inheritance​

Remarks​

This attribute adds a thumbnail preview of the object reference next to the field. Useful for textures, models, or any asset with a visual preview.

Constructors​

ShowAssetPreviewAttribute(int, int)​

Creates a new instance of the ShowAssetPreviewAttribute.

public ShowAssetPreviewAttribute(int width = 64, int height = 64)

Parameters​

NameTypeDescription
widthintWidth of the preview image. Defaults to DefaultWidth.
heightintHeight of the preview image. Defaults to DefaultHeight.

Fields​

DefaultHeight​

The default height (in pixels) of the preview image.

public const int DefaultHeight = 64

Field Value​

int

DefaultWidth​

The default width (in pixels) of the preview image.

public const int DefaultWidth = 64

Field Value​

int

Properties​

Height​

The height (in pixels) of the asset preview image.

public int Height { get; }

Property Value​

int

Width​

The width (in pixels) of the asset preview image.

public int Width { get; }

Property Value​

int