Many page said you just modify UIToggle.vale. It’ll change all button status and call Callback function automaticly.
It’s work fine when My Ap start running and initial function set the UIToggle.vale to default value. But It make very strange when control by another Button’s Script. All flag has be setting but CallBack and Active/Deactive Object not following!
Any one knew loss something?
UIToggle.current.value = true;
UIToggle.current.value = false;
You can create a reference to the UIToggle and update that specific toggle script.
public UIToggle myToggle;
myToggle.current.value = true;
myToggle.current.value = false;
In the UIToggle script you need to link it to a function on value change. This is located under the “On value change”, “Notify”
create a script containing:
public void ToggledValue(){ //name whatever you want
if(UIToggle.current.value){
//the value is true, do something
}else if (!UIToggle.current.value){
//the value is false, do something
}
}
Drag the script containing the “ToggledValue” function into the UIToggle component under notify and select the function “ToggledValue” so that when the UIToggle changes, it will call that function