using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using TMPro; public class optionClicked : MonoBehaviour { public GameObject debug; private OptionLogic latestLevel; public bool done; public string choiseVal; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void ClickButton(string choise){ latestLevel.optionSelected(choise); choiseVal = choise; done = true; } public IEnumerator StartOptionChoise(Action callback){ done = false; bool tick = true; while (!done){ //debug.GetComponent().text = "" + "not done: " + tick + choiseVal + ""; tick = !tick; yield return null; } debug.GetComponent().text = "" + "done: " + choiseVal + ""; callback?.Invoke(choiseVal); } public void SetLevel(OptionLogic level) { debug.GetComponent().text = "" + "set level: " + ""; Debug.Log("SetLevel!!!"); latestLevel = level; } public void timeOut(){ choiseVal = "timeout"; done = true; } }