FullscreenSettingOption - jimdroberts/FishMMO GitHub Wiki
A UI option for adjusting the fullscreen mode in the FishMMO client. Provides a dropdown for users to select the desired fullscreen mode, persists the setting, and applies it to the game window. Integrates with the configuration system and Unity's screen settings.
-
public TMP_Dropdown FullscreenDropdown
The dropdown UI component for selecting fullscreen mode.
-
public override void Initialize()
Initializes the fullscreen setting, sets up listeners, and populates available fullscreen modes. Logs an error if the dropdown is missing.
-
private void PopulateFullscreenSettings()
Populates the dropdown with all available fullscreen modes and sets the current selection.
-
public override void Load()
Loads the saved fullscreen mode from configuration and applies it. Defaults to FullScreenWindow if not set.
-
public override void Save()
Saves the selected fullscreen mode to configuration and applies it.
- Attach
FullscreenSettingOption
to a fullscreen option UI GameObject in the Unity Editor. - Assign the
FullscreenDropdown
field in the Inspector. - Ensure the configuration system is available and properly set up.
// Example usage in a MonoBehaviour
public FullscreenSettingOption fullscreenOption;
void Start() {
fullscreenOption.Initialize();
fullscreenOption.Load();
}
// When the dropdown value changes, Save() is called automatically.
- Always assign the
FullscreenDropdown
in the Inspector to avoid errors. - Use the configuration system to persist user preferences.
- Populate the dropdown with only supported fullscreen modes for the platform.
- Validate required fields and log errors for missing references.