Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Agentfox |
I apologize if this is the wrong category/question title
Currently I have a code for a simple rts that updates the overlay to show what units you can build at certain ‘buildings’ (planets in this case).
The way I set this up is I have a control with a grid container and 5 build buttons for units and the code I have is this:
$PlanetOverlay/BuildButtonsContainer/Build1.text = planet.buildableShips[1]
$PlanetOverlay/BuildButtonsContainer/Build2.text = planet.buildableShips[2]
$PlanetOverlay/BuildButtonsContainer/Build3.text = planet.buildableShips[3]
$PlanetOverlay/BuildButtonsContainer/Build4.text = planet.buildableShips[4]
$PlanetOverlay/BuildButtonsContainer/Build5.text = planet.buildableShips[5]
(buildableShips
is a dictionary for the units buildable at each planet and BuildButtonsContainer
is the grid container)
However, this seems rather clunky and could get hectic when I need 10-20 buttons.
Is there anyway to do this with a for loop? I know you can for the buildableShips
dictionary, but I’m not sure how to do this for getting a child node.