| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- 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<NewQuestion>();
- 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<Text>();
- qc.answerText = GameObject.Find("NewAnswerText").GetComponent<Text>();
- }
- // Update is called once per frame
- void Update()
- {
-
- }
- }
|