I want this SImage to display an image I have placed into my content folder and converted into a material. it appears I need to 1: create an FSlateBrush 2: set the “resource object” to the desired material using the material’s filepath somehow 3: set the SImage image attribute to this freshly created FSlateBrush. If someone could walk me through these steps that would be great but any and all suggestions are welcome.
DUDE… Its done. Strap in this solution is more complex than expected. First I will explain the solution then show the exact code.
1: to access assets in the content browser the only solution I have found is ConstructorHelpers::FObjectFinder this works in my case and can likely be used for other object types. However the slate ‘Construct’ function is not compatible with ConstructorHelpers::FObjectFinder. to use ConstructorHelpers::FObjectFinder with a slate widget I instead call ConstructorHelpers::FObjectFinder in a constructor in my hud cpp file. Then when the hud initializes the slate widget the results of the FObjectFinder can be passed into the slate widget as an argurment.
2: I then declare and initialize a new FSlateBrush in the slate widget ‘Construct’ function, and set its resource object to this argument.
3: setting the slate brush to display as the content of a SImage is then routine.
hud.h:
UCLASS()
class MARBLEGAMEBLUEPRINT_API ATestHud : public AHUD
{
GENERATED_BODY()
public:
ATestHud();
UMaterial* grass_VMUI_1;
//...
}