Change UnityEngine.Experimental.UIElements.Toggle(Action clickEvent) to UnityEngine.Experimental.UIElements.Toggle(Action<bool> clickEvent).
It will simplify design.
This:
void OnEnable()
{
var root = this.GetRootVisualContainer();
toggle = new UnityEngine.Experimental.UIElements.Toggle(x=> Debug.Log(x));
root.Add(toggle);
}
instead of this:
void OnEnable()
{
var root = this.GetRootVisualContainer();
toggle = new UnityEngine.Experimental.UIElements.Toggle(Test);
root.Add(toggle);
}
Toggle toogle;
void Test()
{
Debug.Log(toogle.on);
}
Change
UnityEngine.Experimental.UIElements.Toggle(Action clickEvent)
toUnityEngine.Experimental.UIElements.Toggle(Action<bool> clickEvent)
. It will simplify design. This:instead of this: