Tuesday, November 29, 2022
HomeGame Developmentc++ - UE4 - How can I present in picture utilizing Slate?

c++ – UE4 – How can I present in picture utilizing Slate?


I’m working studying Slate for doing the UI. I’m having an issue setting a background picture. The background is all black and I don’t see the picture anyplace. What am I doing improper? I’ve performed looking the web and the engine code and this appears to be how issues must be performed however I should be lacking one thing.

Right here is my code:

TSharedPtr<FSlateStyleSet> Model = MakeShareable(new FSlateStyleSet("ZombieHorde"));
Model->SetContentRoot(FPaths::ProjectContentDir());
Model->Set(
    FName("check"),
    new FSlateImageBrush(Model->RootToContentDir(TEXT("check"), TEXT(".png")),
    FVector2D(300.0, 300.0),
    FLinearColor(0,0,0,1))
);
    
ChildSlot
[
    SNew(SOverlay) + SOverlay::Slot()
        .VAlign(VAlign_Fill)
        .HAlign(HAlign_Fill)
        [
            SNew(SImage)
                .Image(Style->GetBrush(FName("test")))
        ]
....

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments