UIAchievementCategory - jimdroberts/FishMMO GitHub Wiki

Description

A UI component representing an achievement category in the FishMMO client. Provides a button for selecting the category and a label for displaying the category name. Intended to be used as part of the achievements UI.


API Access

Fields

  • public Button Button

    The button used to select the achievement category.

  • public TMP_Text Label

    The label displaying the achievement category name.


Basic Usage

Setup

  1. Attach UIAchievementCategory to an achievement category UI GameObject in the Unity Editor.
  2. Assign the Button and Label fields in the Inspector.
  3. Integrate with the achievements UI to handle category selection and display.

Example

// Example usage in a MonoBehaviour
public UIAchievementCategory category;

void Start() {
    category.Label.text = "Combat";
    category.Button.onClick.AddListener(() => SelectCategory("Combat"));
}

void SelectCategory(string categoryName) {
    // Handle category selection
}

Best Practices

  • Always assign the Button and Label in the Inspector to avoid null reference errors.
  • Use the button's onClick event to handle category selection logic.
  • Keep the UI updated by setting the label text to the current category name.
⚠️ **GitHub.com Fallback** ⚠️