How to create GUI controls at runtime or dynamically ?

Hi, I want to know how to do that, I thought about cycle “for” but does not work, thanks for you help.

Look at this post - there is a script generating a menu, based on strings defined in the array. It could help.

Thanks, it seems that this is the solution, I change the cycle “if” through the cycle “foreach”, that I need to create controls dynamically from a database, I have a question that I could not solve, such as increased value “size” of the array, as shown in the image below, I could not find the code to do that, thank you very much for you help :smile: .

1203865--48444--$Size.JPG

Yes, this is the not-so-good-choice for user interface from Unity team. :slight_smile:

Just change the number 4 to 5 (manually), and you will get another element slot.

For adding the elements to an array from code, use the generic List class (multiple tutorials on the web).