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

NameType
cameraUnityEngine.Camera
sizeSystem.Int32

Returns

UnityEngine.Texture2D

public static RenderTextureDescriptor CreateStandardDescriptor(int width, int height)

Create render texture descriptor with standard preview settings

Parameters

NameType
widthSystem.Int32
heightSystem.Int32

Returns

UnityEngine.RenderTextureDescriptor

public static Texture2D RenderTextureToTexture2D(RenderTexture rt)

Convert render texture to Texture2D

Parameters

NameType
rtUnityEngine.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

NameType
textureUnityEngine.Texture2D