UIFactionDescription - jimdroberts/FishMMO GitHub Wiki

Description

A UI component for displaying a single faction's description, progress, and value in the FishMMO client. Shows the faction icon, name, description, progress bar, and numeric value. Intended to be used as part of the faction UI to provide detailed information about a selected faction.


API Access

Fields

  • public Image Image

    The image representing the faction icon.

  • public TMP_Text Label

    The label displaying the faction name and description.

  • public Slider Progress

    The slider representing the faction progress value.

  • public Image ProgressFillImage

    The image used to fill the progress bar and show color.

  • public TMP_Text Value

    The text displaying the numeric value of the faction.


Basic Usage

Setup

  1. Attach UIFactionDescription to a faction description UI GameObject in the Unity Editor.
  2. Assign the Image, Label, Progress, ProgressFillImage, and Value fields in the Inspector.
  3. Integrate with the faction UI to update the details when a faction is selected or updated.

Example

// Example usage in a MonoBehaviour
public UIFactionDescription factionDescription;

void ShowFaction(Faction faction) {
    factionDescription.Image.sprite = faction.Icon;
    factionDescription.Label.text = $"{faction.Name}\n{faction.Description}";
    factionDescription.Progress.value = faction.Progress;
    factionDescription.Value.text = faction.Value.ToString();
    // Optionally set ProgressFillImage.color
}

Best Practices

  • Always assign all UI references in the Inspector to avoid null reference errors.
  • Update the UI fields whenever a new faction is selected or its value changes.
  • Use the progress bar and value text to give clear feedback on faction standing.
  • Optionally, use the fill image color to indicate faction status or alignment.
⚠️ **GitHub.com Fallback** ⚠️