private VisualElement CreateSampleItemBool(SampleItemBool item) { var field = new Toggle(nameof(SampleItemBool.BoolValue)); field.value = item.BoolValue; field.RegisterValueChangedCallback(e => item.BoolValue = e.newValue); return(field); }
private VisualElement CreateSampleItemBool(SampleItemBool item, string key) { var foldout = new Foldout(); foldout.text = key; var field = new Toggle(nameof(SampleItemBool.BoolValue)); field.value = item.BoolValue; field.RegisterValueChangedCallback(e => item.BoolValue = e.newValue); foldout.Add(field); return(foldout); }