using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; public class NewQuestionScript : MonoBehaviour { public GameObject prefab; public Transform contentPanel; QuestionCard questionCard; // Start is called before the first frame update void Start() { GetNewQuestionData(); } private void GetNewQuestionData() { // if new game, create one question card to start with GameObject question = Instantiate(prefab, new Vector2(0, 0), Quaternion.identity) as GameObject; questionCard = question.GetComponent(); PrepareQuestion(questionCard); questionCard.GetQuestion(false); questionCard.transform.SetParent(contentPanel); } public void PrepareQuestion(QuestionCard qc) { qc.questionText = GameObject.Find("NewQuestionText").GetComponent(); qc.answerText = GameObject.Find("NewAnswerText").GetComponent(); } }