Hi, I would like to add a Toggle to an already existing togglegroup using the new unity 4.6 UI system:
public class LevelLister : MonoBehaviour {
private List<Level> levelList = new List<Level>(); // list of avaliable levels in the game
private int maxLevel; // max level that should be listed
private Toggle levelItem; // toggle item for a level
public ToggleGroup toggleGroup; // group for level toggles
// Use this for initialization
void Start () {
levelList = new LevelData().GetList();
maxLevel = 2;
for(int i = 0 ; i < maxLevel ; i++) {
levelItem = gameObject.AddComponent<Toggle>();
}
}
}
Now this adds a toggle component to the group but thats not what I want. What I want is to create child objects of that group which are Toggle type objects.