using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; using UnityEngine.UI; public class Choise : MonoBehaviour, OptionLogic { public bool selected = false; public string titleString; public GameObject options; public string optionAText; public bool isCorrectA; public string optionBText; public bool isCorrectB; private string correctOption; private goalTimer goaltimer; public TextMeshProUGUI arrow; public TextMeshProUGUI questionmark; Outline outline; private Transform canvasObject; private Transform player; public GameObject debug; public GameObject goalManager; // Start is called before the first frame update void Start() { //canvasObject = GameObject.Find("Canvas").transform; player = Camera.main.transform; if (isCorrectA){ correctOption = "a"; } else if(isCorrectB) { correctOption = "b"; } goaltimer = goalManager.GetComponent(); selectUnselected(); //StartCoroutine(waiter()); } IEnumerator waiter() { //Wait for 4 seconds yield return new WaitForSecondsRealtime(4); Debug.Log("selectUnselected"); selectUnselected(); } // Update is called once per frame void Update() { //canvasObject.LookAt(player); } public void selectUnselected() { if (selected == false) { selected = true; options.SetActive(true); options.transform.Find("title").GetComponentInChildren().text = "" + titleString + ""; GameObject optionA = options.transform.Find("a").gameObject; TextMeshProUGUI optionAtextObject = optionA.transform.GetChild(0).gameObject.GetComponentInChildren(); optionAtextObject.text = optionAText; optionA.GetComponent