Detailed Method Reference

Namespace: Canley.Utility.CSV.Standard
Interface: ICSVDisplayable<T>

Display

void Display(T record)
  • Description: The mandatory implementation contract triggered automatically by the CSVTable<T>.SpawnUI method for every record in the processed list.

  • Workflow:

    1. Invocation: SpawnUI instantiates the designated UI prefab for each record and automatically invokes this method on components implementing the interface.
    2. Data Binding: Receives the strongly-typed CSVRecord instance (T), allowing developers to map live fields or shadow dictionary values directly to local UI components.
  • Parameters:

    • record: The strongly-typed scriptable object record instance containing the current row’s data.
  • Returns: void

  • Example:

public class ShopSlotUI : MonoBehaviour, ICSVDisplayable<ShopItem>
{
    public Text nameText;
    public Text priceText;
 
    /// <summary>
    /// Binds the shop record data directly to local UI text components.
    /// </summary>
    public void Display(ShopItem record)
    {
        nameText.text = record.itemName;
        priceText.text = $"${record.price}";
    }
}

TIP

Keep your Display implementation focused purely on UI updates and local event binding. Any complex game logic or purchase requests triggered from the UI should be passed up to a manager class rather than handled directly inside this method.