using System.Collections; using UnityEngine; using UnityEngine.SceneManagement; public class SkipAndLoad : MonoBehaviour { [SerializeField] private UIButton _skip; [SerializeField] private UISprite _progres; private AsyncOperation _async; void Start () { //_skip.onClick.Add(new EventDelegate(Skip)); Show(); } private void Update() { //if (_async != null) //{ // _progres.fillAmount = _async.progress; //} } public void Show() { StartCoroutine(_routine()); //_progres.transform.parent.gameObject.SetActive(false); //_skip.gameObject.SetActive(true); } private IEnumerator _routine() { yield return new WaitForSeconds(5); Load(); } private void Skip() { Load(); } private void Load() { //if (!_skip.gameObject.activeSelf) //{ // return; //} //_skip.gameObject.SetActive(false); StartCoroutine(_show()); } private IEnumerator _show() { //_progres.transform.parent.gameObject.SetActive(true); //_skip.gameObject.SetActive(false); _async = SceneManager.LoadSceneAsync("Runner"); yield return _async; } }