I’m trying to make a slate that only contains an image fullscreen and a text in the middle with a font I added (I haven’t gotten to this part yet)
This is what I tried, but when I’m adding that slate on screen the image doesn’t show, but if I switch to color, then the image is red (with those squares):
Store FSlateBrush as a class member.
Currently, you create it in the function as a local variable, which means that it is destroyed when function exits.
I just did a test where I moved both UTexture2D and FSlateBrush inside SLoadingScreen.h with UPROPERTY() as I read somewhere that they might indeed be garbage collected, and yep that was the problem and was about to post the solution to the problem here too, but you beat me to it.
Thank you anyway, if it would have taken me 2 more minutes in my testing I would have seen your suggestion, which would have worked.
I fixed the problem by adding the font in .ttf format, and using: .Font(FSlateFontInfo(FPaths::ProjectContentDir() / TEXT("Fonts/PT_Serif/PT-Serif_Bold.ttf"), 80))
This was the solution for setting a texture to image and it not being destroyed.