Hello!
Well that's because you also need to add this:
for (int i = 0; i < myCheckboxlist.selectionItems.Count; i++)
{
myCheckboxlist.selectionItems[i].itemCheckbox.toggle.isOn = options[i];
}
So the whole thing would be:
bool[] options = new bool[] { true, false, true, true, false };
string[] showComponents = new string[] { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
DialogCheckboxList myCheckboxlist = DialogManager.CreateCheckboxList();
myCheckboxlist.Initialize(showComponents, OnCheckboxValidateClicked, "OK", "Show components", null, null, "Exit");
myCheckboxlist.selectedIndexes = options;
for (int i = 0; i < myCheckboxlist.selectionItems.Count; i++)
{
myCheckboxlist.selectionItems[i].itemCheckbox.toggle.isOn = options[i];
}
myCheckboxlist.Show();
Yes I know, this is not ideal and we should improve that :)
~ Yohan