Adding a string to grid layout group

Hey there,

I’m trying to add a small UI element that tracks some quests. I do this by storing a list of quest objects, out of which I want to add a few elements to my UI in the form of a grid. Here is the code I have at the moment.

public List<Quest> questLog;                // the list containing all the quests

void Start()
{
    foreach (Quest q in questLog)
    {
        bool marker = q.questDisplayed;
        string goal = q.questProgress + " / " + q.questGoal;
        string description = q.questLogDescription;
    }
}

Now my problem is that I can’t seem to be able to wrap my head around adding these elements to my grid. I have added a Grid Layout Group with a constraint of 3 columns, and added that to a Scroll View’s Content section, according to how this tutorial does it.
However, they seem to add an image to the grid and instantiate it, while I want to add 3 different parts to the grid, namely a checkbox and two strings. I could not figure out how to add the text to the grid layout after googling around for some time, so if you have any suggestion as to how I should or can add such components to my grid layout, please leave it in a comment below!

Reply to comment asking for more Information.

Create an empty GameObject with a couple of Texts and an Image(?) as childen to show the information about the Quest and add a script to it you can pass the Quest to.

Example Prefab Script

    public class QuestInfo : MonoBehaviour
    {
    #pragma warning disable 0649
        [SerializeField] private Text _goalText;
        [SerializeField] private Text _descriptionText;
        [SerializeField] private Image _markerImg;
    #pragma warning restore 0649
    
        public void Setup(Quest quest )
        {
            _markerImg.gameObject.SetActive(quest.questDisplayed);
            _goalText.text = quest.questProgress + " / " + q.questGoal;
            _descriptionText.text = quest.questLogDescription;
        }
    }

And then modify your current script to add the prefab and pass the Quest Object to it.

Example Modified Script

public class Quests : MonoBehaviour
    {
        public List<Quest> questList;
        public Transform gridLayoutGroupsTransform;
        public GameObject questInfoPrefab;
    
        void Start()
        {
            foreach (Quest quest in questList)
            {
                GameObject go = Instantiate(questInfoPrefab, gridLayoutGroupsTransform.position, Quaternion.identity);
                go.transform.SetParent(gridLayoutGroupsTransform); 
                
                QuestInfo questInfo = go.GetComponent<QuestInfo>();
                questInfo.Setup(quest);
            }
        }
    }

Hope that makes more sense now.