Create Muk Button #
To create MukButton, create and select MukUICanvas, right-click in the Hierarchy > Muk > Button. You will see a new object(MukButton) 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 MukButton in the newly created MukUICanvas.
Muk Button On Click #
You can set the on click function via script(See below code) or Unity Inspector window(See below section)
using Muk;
// Assign Muk Button in the Inspector window
[SerializeField] private MukButton mukButton;
private void Start()
{
mukButton.onClick.AddListener(() => {
print("Button clicked");
});
}
Muk Button - 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. |
Dark Mode | Use Dark mode or light mode. You can set color for each mode in theme settings. | Dark - Dark Mode. Light - Light Mode. |
Button Type | Button's type | Text - Rectangle with text Icon - Rectangle with icon Icon Text - Rectangle with icon & text Circle Icon - Circle with icon |
Is Interactable | Is Clickable / disabled? | |
Is Show Shadow (Material only) | Is show the shadow? | Shadow is not support for the rounded rect button, so it will get unticked if the border radius is not 0. |
Border Radius | How round is the corner | |
Stroke Width | The width of the stroke | |
Override Background Color | Should override the background color of the button? | If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). If not ticked, the system will get color from theme settings. |
Override Stroke Color | Should override the stroke color of the button? | If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). If not ticked, the system will get color from theme settings. |
Override Disabled Background Color | Should override the background color of the button when it's disabled? | If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). If not ticked, the system will get color from theme settings. |
Override Disabled Text Color | Should override the text color of the button when it's disabled? | If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). If not ticked, the system will get color from theme settings. |
Override Shadow Color (Material only) | Should override the shadow color of the button? | If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). If not ticked, the system will get color from theme settings. |
Override Text Color (For button type that have text) | Should override the text color of the button? | If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). If not ticked, the system will get color from theme settings. |
Text (For button type that have text) | The text to display | |
Override Icon Color (For button type that have icon) | Should override the icon color of the button? | If ticked, it will show two options - iOS & Material, and each option will have two options inside(Light Mode color / Dark Mode Color). If not ticked, the system will get color from theme settings. |
Icon Image (For button type that have icon) | The image for the icon | |
On Click | The callback listener when the button is clicked. |