Quantcast
Channel: Questions in topic: "loadlevelasync"
Viewing all articles
Browse latest Browse all 194

Render Canvas Before LoadScene OnClick

$
0
0
Hi everyone, I am working on a level loader script and have run into an issue here I can't seem to find any info on. Bottom line is I just want to activate a UI Canvas on a button click that also loads a level. public void StartLoad(string levelName) { loadScreen.SetActive(true); StartCoroutine(LoadLevel(levelName)); } IEnumerator LoadLevel(string levelToLoad) { AsyncOperation async = SceneManager.LoadSceneAsync(levelToLoad); while(!async.isDone) { yield return null; } } I am using the UI button OnClick event to call the function StartLoad(string levelName). What happens here is the loadScreen, which is of type GameObject, doesn't show up immediately when I click the button, but instead flashes briefly just before the levelToLoad is loaded. Any thoughts on how to achieve desired effect? Thanks all for your time!

Viewing all articles
Browse latest Browse all 194

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>