using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class SceneChange : MonoBehaviour { public GameObject DataTransfer; public Text errorText; // Start is called before the first frame update bool checkLoadDirFormat() { string thisLoadDirDate = DataTransfer.GetComponent().LoadDirDate; string thisLoadDirTime = DataTransfer.GetComponent().LoadDirTime; int LoadDirDateLength = thisLoadDirDate.Length; int LoadDirTimeLength = thisLoadDirTime.Length; if ((LoadDirDateLength == 8 && LoadDirTimeLength == 6) || (thisLoadDirDate == "0" && thisLoadDirTime == "0")) { return true; } else { return false; } } public void onStartClick() { if (checkLoadDirFormat()) { errorText.text = "Loading next Scene..."; errorText.color = Color.green; SceneManager.LoadScene("InGame"); } else { errorText.text = "Dir Format error"; } } }