private void Instance_OnNewQuest(Quest quest) { if (!questUIElementPrefab) { Debug.LogError("Prefab for QuestUI has not been set in the inspector."); return; } if (!questUIScrollViewContent) { Debug.LogError("Parent for QuestUI Elements has not been set in the inspector."); return; } GameObject questUIElement = Instantiate(questUIElementPrefab, questUIScrollViewContent.transform); QuestUI questUI = questUIElement.GetComponent <QuestUI>(); if (!questUI) { Debug.LogError("Quest UI Element prefab does not have the QuestUI component attached."); return; } questUIElements_.Add(quest, questUI); questUI.InitQuestUI(quest); }