Create Dynamic FSlateBrush for an Array.

Hi, quick question.
I know that in order to use FSlateBrushes in your Widgets you need to have it declared in the header first.

But how do you do if you don’t know how many SImages you’re going to need in advance in a single Widget, is there a way to create one for each Image and in a function or do you need to declare all of them first.

I guess I also could make a class that holds one brush for one image but is there no other way ?

Thanks

The workaround that I’ve done is that I initialize each brush with a

FSlateBrush * BrushPtr = new FSlateBrush();

And I add them all in a TArray <FSlateBrush *> .
At the destruction of my Slate I call a function in which all the brushes of the array are deleted.

I don’t know if it is the most optimized nor the most clean but that seems to work.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.