Add string list to toggle list

I’m trying to take a string list and when I hit the Load List button it populates each list item onto a toggle item.

It’s in a panel–>mask–>Toggles

I’ve created a list of type Toggle and added it to top level game object then set the length and added the toggles into the list.

In the code, I want to see

if (edit_Room.isOn) // toggle in different toggle group

{

foreach (string Data in roomNameList){

   maskToggle.label = roomNameList.label;  //put the data in string list into each toggle

}

Put the string data into the next toggle’s Label spot.

So string list loads

Mountain

Seas

Desert

and then three toggles will have

Mountain

Seas

Desert

populate. The rest of the toggles remain blank. The toggles will load lists then the user has the option of deleting one from the list. However, I can’t even get it to populate first.

How do I do this?

I figured out how by doing this

[SerializeField] GameObject Toggles;
[SerializeField] Transform MaskPanel;
for (int i = 0; i < roomNameList.Count; i++) {
				GameObject toggle = (GameObject) Instantiate (Toggles);
				toggle.GetComponentInChildren<Text>().text = roomNameList*;*
  •  		toggle.transform.parent = MaskPanel;*
    
  •  	}*
    

now I can dynamically load a list for someone to select.