using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class NewQuestionScript : MonoBehaviour { public GameObject prefab; public Transform contentPanel; // 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; NewQuestion questionCard = question.GetComponent(); PrepareQuestion(questionCard); questionCard.GetQuestion(false); Debug.Log("NEWQuestion start " + questionCard.questionText.text); questionCard.transform.SetParent(contentPanel); } public void PrepareQuestion(QuestionCard qc) { qc.questionText = GameObject.Find("NewQuestionText").GetComponent(); qc.answerText = GameObject.Find("NewAnswerText").GetComponent(); } // Update is called once per frame void Update() { } }