not sure why its acting like this i cant see any issues even after rewatching the lecture
public class QuestListUI : MonoBehaviour
{
[SerializeField] QuestItemUI questPrefab;
void Start()
{
//transform.DetachChildren();///|||???///<===== this doesnt destroy the child ?
foreach (Transform item in transform)//<===== this does
{
Destroy(item.gameObject);
}
QuestList questList = GameObject.FindGameObjectWithTag("Player").GetComponent<QuestList>();
foreach (QuestStatus status in questList.GetStatuses())
{
QuestItemUI uiInstance = Instantiate<QuestItemUI>(questPrefab, transform);
uiInstance.Setup(status.GetQuest());
}
}
}
this is where the error is on uiInstance.Setup(status.GetQuest());
this is the QuestItemUI script
public class QuestItemUI : MonoBehaviour
{
[SerializeField] TextMeshProUGUI title;
[SerializeField] TextMeshProUGUI progress;
QuestStatus status;
public void Setup(QuestStatus status)
{
this.status = status;
title.text = status.GetQuest().GetTitle();
progress.text = "0/" + status.GetQuest().GetObjectiveCount();
}
public QuestStatus GetQuestStatus()
{
return status;
}
}
here is the queststatus with the GetQuest
[System.Serializable]
public class QuestStatus
{
[SerializeField] Quest quest;
[SerializeField] List<string> completedObjectives;
public Quest GetQuest()
{
return quest;
}
}