How to manage array with UI

Basically I’m trying to make a team customization system, where these rectangles are characters, when selecting one with the mouse and clicking the middle button, it goes to the other side, the left side should be an array with 3 elements (characters ), and the right side will be another array with 5 elements (characters). The left side is about the current team, and the right side is about the possible characters that I can choose for my team, the left side also cannot have less than one character (team leader).

You would make the Array with all the characters and then reference them inside your widget to select them

I did this part, my doubt now is how to interact with the UI, how to manipulate the array through this flow

You have one side where it has 1 default character and then have the slots.
have a Screen where you can choose the characters you want and the assign to said slot but really all youre doing is Setting the Text inside the box to said characters name and settings the text to visible

the way i usually handle things like this is that a scroll box or vertical box shows all the contents of array (like it takes the names and updates a text slot in a button).

There will be an “update” event which clears the scroll box / vert box of all children, then gets the array and repopulates all the buttons again.

anytime the transfer button is clicked, do the array changes and then call the update events on both scroll boxes.

So in simple terms it is like you have a display which shows the contents of an array, and any time the arrays are changed, the display completely refreshes to show the latest changes.

for updating the arrays, just make an event dispatch that fires when the button is pressed. It probably needs to know who is coming and who is going as parameters. Then whereever the array actually lives can bind to that and update the arrays.

-Save the Widget pointers into a dictionary (Index, Pointer)
-Save the players scores into a dictionary (Name, Score)
-Short the Scores dictionary
-Then change the widget text only (do not move them)
The Easy Way…