LEARNING EXAMPLE

Render a camera view into a caller-owned target

draft illustrative

Origin: original-example · review: draft · snapshot: 3ba1c69afc74a97f-7fcd0798fd6ea455

Example

using Sandbox;
using Sandbox.Rendering;

// Illustrative draft: the target must be created and owned by the caller.
// The reference does not claim this is compile- or runtime-verified.
public static class SecondaryViewRenderingExample
{
    public static bool Render(CameraComponent camera, Texture target, ViewSetup setup)
    {
        if (camera is null || target is null)
            return false;

        return camera.RenderToTexture(target, setup);
    }
}

The camera submits one render-to-texture operation and returns its declared success value.

Constraints and verification

Linked API declarations