Skip to content

CustomMaterialPreviewGenerator

ClassAssetInventoryAssetInventory.Editor
public static class CustomMaterialPreviewGenerator

Custom preview generator for materials. Renders materials on primitive meshes (Sphere, Cube, Plane) with configurable lighting.

public static Task<Texture2D> Create(string materialPath, int size = 128)

Creates a preview texture for the material at the specified path.

Parameters

Name Type Description
materialPath System.String Asset path to the material file.
size System.Int32 Target preview size in pixels.

Returns

System.Threading.Tasks.Task{UnityEngine.Texture2D} — Preview texture, or null if generation failed.

public static Task<Texture2D> Create(Material material, int size = 128)

Creates a preview texture for the specified material object.

Parameters

Name Type Description
material UnityEngine.Material Material to preview.
size System.Int32 Target preview size in pixels.

Returns

System.Threading.Tasks.Task{UnityEngine.Texture2D} — Preview texture, or null if generation failed.