FullscreenSettingOption - jimdroberts/FishMMO GitHub Wiki

Description

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.


API Access

Fields

  • public TMP_Dropdown FullscreenDropdown

    The dropdown UI component for selecting fullscreen mode.

Methods

  • 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.


Basic Usage

Setup

  1. Attach FullscreenSettingOption to a fullscreen option UI GameObject in the Unity Editor.
  2. Assign the FullscreenDropdown field in the Inspector.
  3. Ensure the configuration system is available and properly set up.

Example

// Example usage in a MonoBehaviour
public FullscreenSettingOption fullscreenOption;

void Start() {
    fullscreenOption.Initialize();
    fullscreenOption.Load();
}

// When the dropdown value changes, Save() is called automatically.

Best Practices

  • 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.
⚠️ **GitHub.com Fallback** ⚠️