ScrollViewScript.cs 857 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ScrollViewScript : MonoBehaviour
  5. {
  6. public GameObject prefab;
  7. public Transform contentPanel;
  8. // Start is called before the first frame update
  9. void Start()
  10. {
  11. SetGiventQuestion();
  12. }
  13. public void SetGiventQuestion()
  14. {
  15. // if new game, create one question card to start with
  16. GameObject question = Instantiate(prefab, new Vector2(0,0), Quaternion.identity) as GameObject;
  17. QuestionCard questionCard = question.GetComponent<QuestionCard>();
  18. questionCard.PrepareQuestion();
  19. questionCard.GetQuestion(true);
  20. questionCard.SetQuestionSafe();
  21. questionCard.transform.SetParent(contentPanel);
  22. }
  23. // Update is called once per frame
  24. void Update()
  25. {
  26. }
  27. }