Text Functions


Search Knowledge Base by Keyword

You are here:

On this page:


1. Paint Text

Paint text from UMG/Slate onto a mesh or landscape using a Hit result as input. Use this to stamp text guided by collision impacts, player interaction, etc. If you already know exactly where to stamp the text beforehand (Eg: Shirt names/numbers) use Paint Text At Component instead.

Only materials which have a Don UV node for the specified paint layer are eligible to receive the effect. Conversely, if you have a master material which is setup to receive paint(/text), but want one of your child materials to be excluded, check out the Disabling Paint Layers On Material Instances page.

For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintText
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

Hit Any Hit Result from collision impacts, mouse/cursor hits (projected to world) or any other source.  FHitResult
Text The text to paint. Can be obtained from UMG, Slate or even constructed inline in a Blueprint (LiteralText) or C++ (NSLOCTEXT),  FText
Style Use this to set your Font, Font Size and other text properties. FDonPaintableTextStyle
Color The color of your text. Typically you will just want to use this as a _mask_ and drive your actual text color inside the material.

Note:- Alpha channel does not contain any information/mask for text because of the way it is rendered.

 FLinearColor
Rotation The rotation of your text projection. If you’re using a Mesh UV workflow (characters/etc), then the UV Islands of your UV map will influence the actual rotation. int32
 Paint Layer The paint layer onto which text is to be projected. Each paint layer is a separate texture.

Typically each text needs a dedicated layer as text-material-render doesn’t support alphas.

 int32

 


 

2. Paint Text At Component

While Paint Text requires you to supply a Hit Result, there are times when you already know exactly what component/socket to target for stamping your text. Use Paint Text At Component for that.

Typical example is stamping shirt names or shirt numbers for characters; because the location of the shirt name/number is (typically) fixed, you can use this function and pass in a target socket directly.


For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintTextAtComponent
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

Primitive Component The primitive onto which you desire to paint an effect. Typically a skeletal mesh or a static mesh.  UPrimitiveComponent*
Relative Location The _relative_ location on your mesh for this paint stroke. Ignored if SocketName is also set. Hint:- This is a relative space, not world space location. FVector
Text The text to paint. Can be obtained from UMG, Slate or even constructed inline in a Blueprint (LiteralText) or C++ (NSLOCTEXT),  FText
Style Use this to set your Font, Font Size and other text properties. FDonPaintableTextStyle
Socket Name Specify a socket instead of relative location. Convenient for targeting specific limbs or body parts directly.

Note:- Socket must be accurately placed at the desired part of your mesh for the effect to be rendered precisely.

FName
Color The color of your text. Typically you will just want to use this as a _mask_ and drive your actual text color inside the material.

Note:- Alpha channel does not contain any information/mask for text because of the way it is rendered.

 FLinearColor
Rotation The rotation of your text projection. If you’re using a Mesh UV workflow (characters/etc), then the UV Islands of your UV map will influence the actual rotation. int32
 Paint Layer The paint layer onto which text is to be projected. Each paint layer is a separate texture.

Typically each text needs a dedicated layer as text-material-render doesn’t support alphas.

 int32