Generating List (conversion from old GUI)

Hey guys just looking for some clarification and direction

i have quite a few list in my game, ive seen something about having to use instantiation to generate in new UI is this correct?

for instance in old GUI:

foreach(Gun gn in myGunList)
{
     GUILayout.Label(gn.GunName);
}

and your done

etc same goes for the buttons …you get the picture…

is instantiating the only way to do this currently in the new GUI?

It’s not the only way, but it’s probably the most practical one, as it lets you have more control over the items before you add them. The way I approach it is to have a panel with a VerticalLayoutGroup, and then I Instantiate a prefab for each row. I found there were several gotchas involved too, such as needing to set LayoutElements on the items in the row to make sure they didn’t get compressed down to zero height, moving the panel pivot to the top to ensure new items got added to the bottom (rather than moving the panel up to accommodate them), etc.

Thanks for the response ill play with it and repot back im sure i wont get it right the first…havent even played with vertical layout groups