Код: Выделить всё
int count = 0;
foreach(OMD i in settings)
{
if (i.type == OMDSetting.toggle) {
Components.Register(toggle, EventTriggerType.PointerClick, () => OnToggleUp(toggle, count));
y -= 60;
}
count++;
}
Код: Выделить всё
public static void OnToggleUp(GameObject toggle, int index)
{
OMD s = settings[index];
s.b = toggle.GetComponent().isOn;
settings[index] = s;
}
Есть ли в C# способ обойти это?
Подробнее здесь: https://stackoverflow.com/questions/791 ... -a-variabl