Navigation
Unreal Engine C++ API Reference > Runtime > Engine > Engine
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UStreamableRenderAsset
- UTexture
- UTextureRenderTarget
- UTextureRenderTarget2D
- UCanvasRenderTarget2D
References
Module | Engine |
Header | /Engine/Source/Runtime/Engine/Classes/Engine/CanvasRenderTarget2D.h |
Include | #include "Engine/CanvasRenderTarget2D.h" |
Syntax
class UCanvasRenderTarget2D : public UTextureRenderTarget2D
Remarks
CanvasRenderTarget2D is 2D render target which exposes a Canvas interface to allow you to draw elements onto it directly. Use CreateCanvasRenderTarget2D() to create a render target texture by unique name, then bind a function to the OnCanvasRenderTargetUpdate delegate which will be called when the render target is updated. If you need to repaint your canvas every single frame, simply call UpdateResource() on it from a Tick function. Also, remember to hold onto your new canvas render target with a reference so that it doesn't get garbage collected.
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
bool | bShouldClearRenderTargetOnReceiveUpdate | If true, clear the render target to green whenever OnReceiveUpdate() is called. |
![]() |
FOnCanvasRenderTargetUpdate | OnCanvasRenderTargetUpdate | Called when this Canvas Render Target is asked to update its texture resource. |
![]() |
TWeakObjectPtr< UWorld > | World | The world this render target will be used with |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
UCanvasRenderTarget2D
(
const FObjectInitializer& ObjectInitializer |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
UCanvasRenderTarget2D * | CreateCanvasRenderTarget2D
(
UObject* WorldContextObject, |
Creates a new canvas render target and initializes it to the specified dimensions |
![]() |
void | Don't delete the underlying resource if it already exists | |
![]() |
void | GetSize
(
int32& Width, |
Gets a specific render target's size from the global map of canvas render targets. |
![]() ![]() ![]() |
UWorld * | GetWorld () |
|
![]() |
void | ReceiveUpdate
(
UCanvas* Canvas, |
Allows a Blueprint to implement how this Canvas Render Target 2D should be updated. |
![]() |
void | ||
![]() |
void | SetShouldClearRenderTargetOnReceiveUpdate
(
bool bInShouldClearRenderTargetOnReceiveUpdate |
|
![]() ![]() |
bool |
Overridden from UTexture
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | Updates the the canvas render target texture's resource. |