Create Muk Toggle #
To create MukToggle, create and select MukUICanvas, right-click in the Hierarchy > Muk > Switch Toggle. You will see a new object(MUKSwitchToggle) created in the selected canvas or the first canvas in the Hierarchy (if no canvas is selected). If there’s no canvas in the Hierarchy, Muk will create a MukUICanvas for you and place the MUKSwitchToggle in the newly created MukUICanvas.
Muk Toggle Code #
You can set the on value change listener via script. Please see the code below.
Muk Circular Indicator - Properties #
Property | Desciption | Value |
---|---|---|
Platform Type | Which UI Platform should Muk Components display. | Device - Base on device. iOS UI for iOS device, Material design for others. iOS - iOS design. Material - Material design. |
Material Version | Which Material design version to use. | Material_3 - Use the Material 3 design. Material_2 - Use the Material 2 design. |
Dark Mode | Use Dark mode or light mode. You can set color for each mode in theme settings. | Dark - Dark Mode. Light - Light Mode. |
Enable | Is Enabled | On Off |
Is Toggle On | Status of the toggle | On Off |
On Background Color Property | The background color of the toggle when it's on. | You can choose iOS / Material Color from the drop down list, this list is from MukAppThemeData. If there's no color you like, you can tick the Override color property, then choose the color you like. If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). |
Off Background color Property | The background color of the toggle when it's off. | You can choose iOS / Material Color from the drop down list, this list is from MukAppThemeData. If there's no color you like, you can tick the Override color property, then choose the color you like. If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). |
On Handle Color Property | The handle color of the toggle when it's on | You can choose iOS / Material Color from the drop down list, this list is from MukAppThemeData. If there's no color you like, you can tick the Override color property, then choose the color you like. If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). |
Off Handle Color Property | The handle color of the toggle when it's off. | You can choose iOS / Material Color from the drop down list, this list is from MukAppThemeData. If there's no color you like, you can tick the Override color property, then choose the color you like. If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). |
Stroke Color Property | The stroke color of the toggle | You can choose iOS / Material Color from the drop down list, this list is from MukAppThemeData. If there's no color you like, you can tick the Override color property, then choose the color you like. If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). |
On Value Change | Call back for when the toggle status change. |
using Muk2;
// Assign MukSwitchToggle in the Inspector window
[SerializeField] private MukSwitchToggle mukSwitchToggle;
private void Start()
{
mukSwitchToggle.onValueChanged.AddListener(OnToggleValueChange);
}
public void OnToggleValueChange(bool isOn)
{
print("OnToggleValueChange " + isOn);
}