You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
720 B
24 lines
720 B
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// This class' only purpose is to set the description of a UI element
|
|
/// </summary>
|
|
[RequireComponent(typeof(TextMeshProUGUI))]
|
|
public class ItemDescriptionDisplay : MonoBehaviour
|
|
{
|
|
private TextMeshProUGUI text;
|
|
private void Start()
|
|
{
|
|
text = GetComponent<TextMeshProUGUI>(); // Because of the meta tag, Unity will make sure this exists. No sanity checks
|
|
}
|
|
|
|
public void SetDescription(string desc)
|
|
{
|
|
if(text == null) text = GetComponent<TextMeshProUGUI>(); // Just in case this gets called before Start()
|
|
text.text = desc.ToString();
|
|
}
|
|
}
|
|
|