<aside> <img src="/icons/reorder_gray.svg" alt="/icons/reorder_gray.svg" width="40px" />
Navigation
</aside>
<aside> 💡 UISettings is a popup with the sound and haptic toggles and the link buttons. Each button is a small component derived from SettingsButtonBase.
</aside>
The prefab is UI Game Settings in Assets/Project Files/Game/Prefabs/UI/Canvas.

UISettings is a popup (IsPopup is true). It has a fade background and a scaled panel. A tap on the background or on the close button closes it. UISettings.Show() opens the page.
The page can be opened from the game page while the game is paused, so the animations run on unscaled time.
Add the component to any button that opens the settings. It calls UIController.ShowPage<UISettings>() and plays the button sound. The settings button of the start screen is handled by UIStartScreen, so use this component for buttons on other pages.
| Class | Behavior |
|---|---|
| SettingsSoundToggleButton | Toggles an audio type or all audio types. The Universal flag selects all types. Otherwise, set the Type (sound or music). |
| SettingsHapticToggleButton | Toggles the haptic feedback through Haptic.IsActive. |
| SettingsLinkButton | Opens the Url field in the browser. |
| SettingsPrivacyButton | Opens the privacy link from Ads Settings. The button is hidden when the link is empty or when the Advertisement module is not installed. |
| SettingsTermsButton | Opens the terms of use link from Ads Settings. The button is hidden when the link is empty. |
| SettingsRestoreButton | Restores in-app purchases. The button is hidden when the Purchasing module is not initialized. |
Derive from the class to add a button. It caches the Button in Start, adds the click listener and calls Init().
using UnityEngine;
namespace Watermelon
{
public class SettingsRateButton : SettingsButtonBase
{
[SerializeField] string storeUrl;
public override void Init()
{
// Hide the button when the url is empty
gameObject.SetActive(!string.IsNullOrEmpty(storeUrl));
}
public override void OnClick()
{
Application.OpenURL(storeUrl);
AudioController.PlaySound(AudioController.GetClip("button_sound"));
}
}
}
Select() and Deselect() are virtual and support gamepad or keyboard navigation.
SettingsButtonBase.