Assigning name or index to SButton?

I have grid of buttons and I need to differentiate them somehow. The number of buttons is always different so Hard coding functions does not work.

Is there a way to assign an index or a name to individual SButton?

I forgot to mention I am doing this in slate c++

But this gave me an idea that I could create button widget in slate as well, I’ll try that

create a widget for the button and add an int variable to it and make that variable “Editable” and “Expose on Spawn” enable.

add a horizontal box ( or something like that) in the main widget and make it variable.

334835-widget1.jpg

now add created widget to your main widget with a loop and set that variable with the loop. I send my logic for you, check it in this link.

[Spawn Button logic][3]

nothing changes a lot, just do all things that I said in Blueprint, in c++