RealDocs

UKismetRenderingLibrary::BeginDrawCanvasToRenderTarget

function Engine Blueprint Since unknown
#include "Kismet/KismetRenderingLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallable

Description

Begins a canvas drawing session targeting a render target, returning a Canvas you can issue multiple draw calls on before finishing with EndDrawCanvasToRenderTarget.

Caveats & Gotchas

  • Every call to BeginDrawCanvasToRenderTarget must be paired with a matching EndDrawCanvasToRenderTarget using the same Context — forgetting to close it leaves the render target in an inconsistent state.
  • Prefer this over repeated DrawMaterialToRenderTarget calls when drawing multiple primitives to the same target, since DrawMaterialToRenderTarget re-binds the render target on every call which is expensive.
  • The returned Canvas is only valid between the Begin/End pair — do not cache it and use it later.

Signature

static void BeginDrawCanvasToRenderTarget(UObject* WorldContextObject, UTextureRenderTarget2D* TextureRenderTarget, UCanvas*& Canvas, FVector2D& Size, FDrawToRenderTargetContext& Context)

Parameters

Name Type Description Default
WorldContextObject UObject* World context used to resolve the current world.
TextureRenderTarget UTextureRenderTarget2D* The render target to draw into.
Canvas UCanvas*& Out parameter, filled with a Canvas object to issue draw calls on.
Size FVector2D& Out parameter, filled with the render target's dimensions.
Context FDrawToRenderTargetContext& Out parameter, an opaque context that must be passed to EndDrawCanvasToRenderTarget.

Return Type

void

Example

Draw multiple primitives to a render target Blueprint
Call Begin Draw Canvas To Render Target with the target render target, obtaining Canvas, Size, and Context. Issue one or more Canvas draw calls (e.g. Draw Material, Draw Text) using Canvas and Size. Finish by calling End Draw Canvas To Render Target with the same Context.

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.