Skip to content

SceneViewCameraRenderer

ClassAssetInventoryAssetInventory.Editor
public static class SceneViewCameraRenderer

Utility for rendering GameObjects using a temporary scene and camera. This bypasses VFX Graph’s visibility limitations with custom cameras.

CaptureWithSceneCamera(GameObject, int, int, Action<Camera, Scene, PreviewSceneContext>)

Section titled “CaptureWithSceneCamera(GameObject, int, int, Action<Camera, Scene, PreviewSceneContext>)”
public static Texture2D CaptureWithSceneCamera(GameObject target, int width, int height, Action<Camera, Scene, PreviewSceneContext> setupCamera = null)

Capture a GameObject using a temporary scene and camera

Parameters

Name Type Description
target UnityEngine.GameObject GameObject to render
width System.Int32 Render texture width
height System.Int32 Render texture height
setupCamera System.Action{UnityEngine.Camera,UnityEngine.SceneManagement.Scene,AssetInventory.PreviewSceneContext} Optional callback to setup camera (position, settings, etc.)

Returns

UnityEngine.Texture2D — Rendered texture or null on failure