So I’ve recently been trying to learn slate, taking a little bit of what I know about UMG with me…
GEngine->GameViewport->AddViewportWidgetContent( SNew(SCanvas) + SCanvas::Slot() .HAlign(HAlign_Center) .VAlign(VAlign_Center) .Position(FVector2D(0,0)) SNew(STextIndicator) .Text(FText::AsNumber(2000)) ] );
STextIndicator is defined as
SNew(SOverlay) + SOverlay::Slot() SNew(STextBlock) .ShadowColorAndOpacity(FLinearColor::Black) .ColorAndOpacity(FLinearColor::White) .ShadowOffset(FIntPoint(-1, 1)) .Font(FSlateFontInfo("Veranda", 16)) .Text(Text) ] ];
I wanted to position something absolutely on the screen, so I tried using SCanvas. I figured this should show up in the center or bottom or top left corner of the screen but it doesn’t. I tried various H, V Aligns and no success. If I want to position this at an absolute position, with a set alignment in viewport (like in UMG), how can I do this with slate?