Adding custom buttons/toggles
- In your project hierarchy under the
UI
section expandCanvas > StatusBar > QuickSettings
and click onButtons
- Now right click on on
Buttons
and selectUI > SmartifyOS > More > Quick Settings > Button
orUI > SmartifyOS > More > Quick Settings > Toggle
for a toggle - If you now select the new button you can set it icon and text In inspector tab (for a toggle you can add two icons)
Custom Button/Toggle script
Right click in your project browser and click on Create > SmartifyOS > More > Quick Settings Entry
and name the script.
Button
For a button you need
using SmartifyOS.QuickSettings;
public class NewQuickSettingsEntry : BaseQuickSettingsEntry
{
private void Start()
{
Init();
}
//Executed if this script is on a gameobject together with QuickSettings.Button component
protected override void OnClick()
{
Debug.Log("Clicked");
}
}
Toggle
For a toggle you need
using SmartifyOS.QuickSettings;
public class NewQuickSettingsEntry : BaseQuickSettingsEntry
{
private void Start()
{
Init();
}
//Executed if this script is on a gameobject together with QuickSettings.ToggleButton component
protected override void OnToggleValueChanged(bool isOn)
{
Debug.Log("Toggled: " + isOn);
}
}
You can also set the toggle
protected void SetToggle(bool isOn)