UIAchievementDescription - jimdroberts/FishMMO GitHub Wiki

Description

A UI component for displaying the details of an achievement in the FishMMO client. Shows the achievement icon, description, progress, and value. Intended to be used as part of the achievements UI to provide detailed information about a selected achievement.


API Access

Fields

  • public Image Image

    The image representing the achievement icon.

  • public TMP_Text Label

    The label displaying the achievement description.

  • public Slider Progress

    The slider showing the achievement progress.

  • public TMP_Text Value

    The text displaying the current and maximum achievement value.


Basic Usage

Setup

  1. Attach UIAchievementDescription to an achievement description UI GameObject in the Unity Editor.
  2. Assign the Image, Label, Progress, and Value fields in the Inspector.
  3. Integrate with the achievements UI to update the details when an achievement is selected.

Example

// Example usage in a MonoBehaviour
public UIAchievementDescription achievementDescription;

void ShowAchievement(Achievement achievement) {
    achievementDescription.Image.sprite = achievement.Icon;
    achievementDescription.Label.text = achievement.Description;
    achievementDescription.Progress.value = achievement.Progress;
    achievementDescription.Value.text = $"{achievement.Current}/{achievement.Max}";
}

Best Practices

  • Always assign all UI references in the Inspector to avoid null reference errors.
  • Update the UI fields whenever a new achievement is selected.
  • Use the progress slider and value text to give clear feedback on achievement completion.
⚠️ **GitHub.com Fallback** ⚠️