Class CanvasRenderTarget2D
CanvasRenderTarget2D is 2D render target which exposes a Canvas interface to allow you to draw elements onto it directly.
Inheritance
Inherited Members
Namespace: UE4.Engine
Assembly: UE4DotNet.dll
Syntax
public class CanvasRenderTarget2D : TextureRenderTarget2D
Remarks
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.
Properties
| Improve this Doc View SourcebShouldClearRenderTargetOnReceiveUpdate
Declaration
public bool bShouldClearRenderTargetOnReceiveUpdate { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
DefaultObject
Get UE4 Default Object for this Class
Declaration
public static CanvasRenderTarget2D DefaultObject { get; }
Property Value
Type | Description |
---|---|
CanvasRenderTarget2D |
StaticClass
Get UE4 Class
Declaration
public static Class StaticClass { get; }
Property Value
Type | Description |
---|---|
Class |
Methods
| Improve this Doc View SourceCreateCanvasRenderTarget2D(UObject, SubclassOf<CanvasRenderTarget2D>, Int32, Int32)
Creates a new canvas render target and initializes it to the specified dimensions @
Declaration
public static CanvasRenderTarget2D CreateCanvasRenderTarget2D(UObject WorldContextObject, SubclassOf<CanvasRenderTarget2D> CanvasRenderTarget2DClass, int Width, int Height)
Parameters
Type | Name | Description |
---|---|---|
UObject | WorldContextObject | |
SubclassOf<CanvasRenderTarget2D> | CanvasRenderTarget2DClass | |
System.Int32 | Width | |
System.Int32 | Height |
Returns
Type | Description |
---|---|
CanvasRenderTarget2D |
Remarks
param WorldContextObject The world where this render target will be rendered for @param CanvasRenderTarget2DClass Class of the render target. Unless you want to use a special sub-class, you can simply pass UCanvasRenderTarget2D::StaticClass() here. @param Width Width of the render target. @param Height Height of the render target.
@return Returns the instanced render target.
GetSize()
Gets a specific render target's size from the global map of canvas render targets.
Declaration
public (int, int) GetSize()
Returns
Type | Description |
---|---|
System.ValueTuple<System.Int32, System.Int32> |
Remarks
@param Width Output variable for the render target's width @param Height Output variable for the render target's height
New(UObject, Name)
Spawn an object of this class
Declaration
public static CanvasRenderTarget2D New(UObject obj = null, Name name = default(Name))
Parameters
Type | Name | Description |
---|---|---|
UObject | obj | |
Name | name |
Returns
Type | Description |
---|---|
CanvasRenderTarget2D |
UpdateResource()
Updates the the canvas render target texture's resource.
Declaration
public void UpdateResource()
Remarks
This is where the render target will create or find a canvas object to use. It also calls UpdateResourceImmediate() to clear the render target texture from the deferred rendering list, to stop the texture from being cleared the next frame. From there it will ask the rendering thread to set up the RHI viewport. The canvas is then set up for rendering and then the user's update delegate is called. The canvas is then flushed and the RHI resolves the texture to make it available for rendering.
Events
| Improve this Doc View SourceReceiveUpdate
Allows a Blueprint to implement how this Canvas Render Target 2D should be updated.
Declaration
public event CanvasRenderTarget2D.ReceiveUpdate_delegate ReceiveUpdate
Event Type
Type | Description |
---|---|
CanvasRenderTarget2D.ReceiveUpdate_delegate |
Remarks
@param Canvas Canvas object that can be used to paint to the render target @param Width Width of the render target. @param Height Height of the render target.
Operators
| Improve this Doc View SourceImplicit(IntPtr to CanvasRenderTarget2D)
Convert from IntPtr to UObject
Declaration
public static implicit operator CanvasRenderTarget2D(IntPtr p)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | p |
Returns
Type | Description |
---|---|
CanvasRenderTarget2D |