DropdownCanvasTypeSettings - jimdroberts/FishMMO GitHub Wiki

Description

The DropdownCanvasTypeSettings class is a canvas type settings handler for Unity's Dropdown component in the FishMMO client. It applies color settings from a configuration file to the dropdown's color states, enabling consistent theming and easy customization of dropdown appearance.


API Access

Methods

  • public override void ApplySettings(object component, Configuration configuration)

    Applies color settings from configuration to the given Dropdown component. Sets the dropdown's normal, pressed, and highlighted colors using values parsed from the configuration.


Basic Usage

Setup

  1. Ensure DropdownCanvasTypeSettings is registered in your canvas settings map for Dropdown components.
  2. Store color values (Primary, Secondary, Highlight) in your configuration file.
  3. When ApplySettings is called, the dropdown's color states will be updated according to the configuration.

Example

// Example usage in a canvas crawler or theming system:
var dropdown = myGameObject.GetComponent<Dropdown>();
var settings = new DropdownCanvasTypeSettings();
settings.ApplySettings(dropdown, configuration);

Best Practices

  • Store all color values in a configuration file for easy theme changes.
  • Use DropdownCanvasTypeSettings to centralize and automate dropdown theming across your UI.
  • Register this handler in your canvas settings map to ensure all dropdowns are themed consistently.
  • Extend or override for custom dropdown behavior or additional color states if needed.
  • Validate component types in ApplySettings to avoid runtime errors.
⚠️ **GitHub.com Fallback** ⚠️