UIAchievementCategory - jimdroberts/FishMMO GitHub Wiki
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.
-
public Button Button
The button used to select the achievement category.
-
public TMP_Text Label
The label displaying the achievement category name.
- Attach
UIAchievementCategory
to an achievement category UI GameObject in the Unity Editor. - Assign the
Button
andLabel
fields in the Inspector. - Integrate with the achievements UI to handle category selection and display.
// 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
}
- Always assign the
Button
andLabel
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.