Assigning property to created component mesh

I am trying to create an array of clickable boxes that will be a base for let’s call it chessboard. I’ve managed to create an array of objects like shown in pic

and the blueprint itself

. What i did later was to create a function that would print the name of the component of “board” blueprint that was hit by left mouse button. I’ve reached this

, which does not satissfy me as i need to use the name or the index of component later to be able to f.example change material of one particular component. So my question is what can i do to be able to assign a value as a property of each box to know which of them is number 1 and which is 400 and so on and so on, and it would be lovely if the number would correspond to the sequence the boxes were created.
PS the yellowish color was assigned during creation of static mesh for all boxes created under loop index from 161-220, and i would love to save this index in some kind of an array or any other kind of variables/tags etc. to be able to use it later. (I still mean the way that i the index is assigned to component, so if i say component with index 180 changes its material to blue for exmaple.)
PS’ Plz help

The way I would solve this is the following:

First, create a new blueprint called Box (or something similar) and populate it with all the variables that you want - index, color, additional components, whatever.

Second, create another blueprint called BoxCoordinator, which would control the spawning, destroying and general bulk actions on Boxes. Additionally it would also hold the index for all Boxes (array of Box references), just for convenience.

Next, to make it more interesting, you could make an interface that would hold all the most used functions for accessing and changing variables from the BoxCoordinator on the Boxes itself.

Examples of such functions would be:

A function that changes the color of a Box with a specific index.

A function that gets all the Boxes that are in a specific color.

A function that gets all the Boxes in the n-th row.

A function that spawns a new Box row.

A function that destroys the n-th column and fills up the empty space with boxes from the n+1-th+ columns

Etc. you get the point.

Furthermore, as the next step, It would also be nice if you properly split the logic between the Box and the BoxCoordinator. What I mean by this is to have all the Box-related functions on the Box blueprint and to have all the functions that perform bulk actions on the BoxCoordinator. For example, you would have a function named ChangeColor on the Box blueprint and ChangeRowColor on the BoxCoordinator blueprint that would iteratively call ChangeColor on all the boxes of the n-th row.

I hope this helps.

Your tip was very helpful but i found another problem with setting a variable of child actor component, which was the fact that it cant inherit the index. I guess i did something wrong but i found another solution for the problem. I simply needed to int->string and then string->name and now i can set tag of a component as the index of creation so it absolutely solved the problem.

I also tried to do it other way but i faced problems with casting i dont understand well yet and i could not find any function that would allow me to connect the reurn value to set(index) of childactor(component). Once I managed to plug sth to the target node but i got an information that cast would always fail beacause the box(actor that is in my board BP) cannot inherit from the board so i guess i will keep going with the solution i found but i hope you can give me some tip how to do the casting properly.
PS Thank you very much for helping me to find a solution.