Skip to content

PreviewRenderUtilities

ClassAssetInventoryAssetInventory.Editor
public static class PreviewRenderUtilities

Centralized render texture management and utilities for preview generation.

public static Texture2D RenderCameraToTexture(Camera camera, int size)

Render camera to texture with proper MSAA and depth handling

Parameters

Name Type
camera UnityEngine.Camera
size System.Int32

Returns

UnityEngine.Texture2D

public static RenderTextureDescriptor CreateStandardDescriptor(int width, int height)

Create render texture descriptor with standard preview settings

Parameters

Name Type
width System.Int32
height System.Int32

Returns

UnityEngine.RenderTextureDescriptor

public static Texture2D RenderTextureToTexture2D(RenderTexture rt)

Convert render texture to Texture2D

Parameters

Name Type
rt UnityEngine.RenderTexture

Returns

UnityEngine.Texture2D

public static void ExtractAlphaFromLuminance(Texture2D texture)

Extract alpha from luminance for transparent backgrounds with particles Particles don’t render correctly against Color.clear, so we render against black and extract alpha from brightness

Parameters

Name Type
texture UnityEngine.Texture2D