Hello. I would like to attach a listener to checkbox:
void Start ()
{
GameObject cb1 = (GameObject)Instantiate(cbPrefab);
Toggle t = cb1.GetComponent<Toggle>();
t.onValueChanged.AddListener(() => handleCheckbox(value)); **error here**
}
void handleCheckbox(bool value)
{
print("handleCheckbox. value=" + value);
}
The compile error that I get is:
error CS1593: Delegate `UnityEngine.Events.UnityAction<bool>' does not take `0' arguments
Could somebody help me to fix this? Thanks!