What is the Context in DrawText node?

Seems like you picked the wrong Draw Text Node.

I’m using 4.4 and can find the old and the “new” one that you found.

You need to take the one under “HUD” and not the one under “Painting”:

And be sure that you are inside your HUD Class.

I am on 4.5 preview, and my Draw Text Blueprint node does look different to all docs and tutorials that I’ve seen>

17554-drawtext.png

I guess that Position replaces the old screen positions (and I have to include the scaling somewhere else)? And I can’t figure out what I have to pass in as the “Context”- everything (even object references) I’ve tried gives an error that “Literal values are not allowed for pass-by-reference parameters”.

How do I use this thing?

Oh, how embarrassing… Of course the node I am looking for is available in HUD Blueprints… pass by, nothing to see here…

Although I’d still be interested to know what that context above is.

Did anyone figure out what context is?

Draw Box | Unreal Engine Documentation came across this which is also under painting. No documentation anywhere. Will be of great help if someone explain what painting category is and what exactly is context

Context - its a ref to Paint Context Structure.

U can get it if u override ‘onPaint’ function.

http://i.imgur.com/Yy4xABS.png

How to override the onPaint function?

http://i.imgur.com/7qoscpm.png

So badly, your DrawText is only effective under HUD class, not under UMG, say Widget. Detech’s answer is right

OP was searching the HUD Draw Text node to match the tutorial he’s watching/reading.
Given I told him that he needs to look for another node, which solved his question, I don’t see my answer being wrong.
I do, Indeed, not answer the “Context” question, however Detech didn’t explain it either.
He only said where to get that Ref from, not what it actually is doing.

So to additionally answer that question:

“Context” is a Struct (FPaintContext) used to expose the “OnPaint” function to Blueprints.

These are its properties:

const FGeometry& AllottedGeometry;
const FSlateRect& MyClippingRect;
FSlateWindowElementList& OutDrawElements;
int32 LayerId;
const FWidgetStyle& WidgetStyle;
bool bParentEnabled;
int32 MaxLayer;

It’s passed by REF when using the OnPaint function, which is located in “UUserWidget”.

FPaintContext is used by multiple functions, that can be found in “UWidgetBlueprintLibrary”.
As an example, let’s take the “DrawText” function:

When ever something new is drawn with OnPaint, it increases the persistant Context’s “MaxLayer” count.
Then it passes multiple parameters to “FSlateDrawElement::MakeText(…)”, which uses some of the Context variables.

“OutDrawElements” will be filles with the Elements we want to draw.
“MaxLayer” is used to tell “MakeText” which Layer we are on.
“AllottedGeometry.ToOffsetPaintGeometry(Position)” turns the AllottedGeometry into a PaintGeometry, which basically contains all information to draw the element on the screen (size and position wise).
That includes the local size of the element.
Well and the “MyClippingRect” is simply used for clipping the text with the passed rectangle.

For more information, simply check out the mentioned function names in the source code.

Cheers.