array of buttons to communicate with an array in BP

Hi, I am trying to create a BP for changing material of an object. what i did was i created a BP and added static mesh component, then i created a separate UMG with various buttons and call event dispatcher with on clicked event, then inside that BP i assigned the event dispatcher event to change the material of the static mesh in the BP, but i want to make this more scalable, as i might have 100s of materials to show on different static meshes. I can create an array of materials in the BP but I do not know how to create an array of buttons and make it communicate with the BP. Kindly guide me in the right direction.
Thanks

How do you plan to fit hundreds of buttons on your screen?

Tabs and scrollbar, already functional. button divided in the categories such as Wood, Laminates, Stones etc. 7 or 8 categories, with around 10 to 15 buttons each categories.

my first instinct is to just loop through all the Staticmesh actors in the level and Create Widget for the button and change its settings based on the Staticmesh’s variables (all the staticmesh actors could have a parent class in common so they all have the same set of variables but these are set differently)
and then just add the button into your scrollbox, and that all happens within the loop over all those static mesh actors

I would create a widget class named MaterialButton with an exposed variable for the material it will show, its category (make an enum) and maybe an icon of some sort.

Then I would use the array of all the materials to run the same number of create widget nodes and feed the material information into the button and add it to its respective category depending on the category enum using SwitchOnEnum.

Then when you click the button make it so it runs a function to set whatever mesh you want to use the material you want.

But would it serve the purpose of making a blueprint that contains the staticmesh in itself and reusable in any other project, just drag and drop?

I tried to implement the method youve proposed but my understanding of enum is limited, could you please explain a little more?

That’s the idea - that’s why I was thinking make a new Actor class that has a StaticMesh component that can be set at runtime. Hopefully that will work. StaticMeshComponents have material slots, but they get THAT info from the Mesh asset that is set on them.