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

Execute script when scene is visible to player

$
0
0
Hi all When using scenemanager I am having differences between editor and device. I have a singleton game manager which sets up some logic and then loads next scene which is the menu scene. On that menu scene I have a countdown script which starts at 10 down to 1. This is hooked up to a Unity UI text control and updates the correct count in the editor as expected. However, when I check on a device the menu scene loads but there is a bigger delay and by the time I can see the new scene the countdown is already down to 4. How can I consistently manage the transition so that I only start scripts / animations when visible to cater for the different loading speeds and behaviours between hardware? I have tried **scenemanager.loadsceneasync** as well as **AsyncOperation** such as **allowSceneActivation** to false as well as checking **isDone** and none have the desired effect. Also **OnLevelWasLoaded** has an unpredictable execution order. What would you suggest for a true "is visible to user" and "is fully loaded" check to kick off these scripts?

Viewing all articles
Browse latest Browse all 194

Trending Articles



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