I try to setup a multiplayer game, where each player has his own UI (health bar etc). Creating said UI when a player joins and positioning is no problem, however, I'm struggling to find a solution on how to identify which health bar belongs to which player.
My first idea was to write the UIDs of each UI element into certain columns of an array, so I could get those UIDs and therefor the correct element if I need it. However, this seems a little bit messy/complicated for me (I started using arrays and understand the basics, I find it just hard to handle them, as I do not have a visual representation like a table) and I wonder if there are better solutions.
My "perfect" solution, which doesn't seem to be possible with C2, would be to group UI elements of a player together. When a player joins and his UI is created, I add every UI element that belongs to him to the group PlayerUI1 for example. If I now want to do something with the healthbar of player 1, I would access it by something like PlayerUI1.Child("Healthbar") or an event like "Pick Child of Group".
As I said, the example solution doesn't seem to be supported by C2. I also thought about using families or containers, but both are not providing the events/actions I need.
Does anybody have an idea on how to solve that problem without using an array? Thanks in advance!