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.

public const string PREFAB_MODE_REASON = "This preview cannot be generated while editing a prefab. Close Prefab Mode and regenerate the preview."

Returns

System.String

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

NameTypeDescription
targetUnityEngine.GameObjectGameObject to render
widthSystem.Int32Render texture width
heightSystem.Int32Render texture height
setupCameraSystem.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