So I have two scripts that are run at Start(): PlacePeople and PlaceCars that scatter people and cars in my scene. It can take a while, so I wanted percentage bars to show you why the game wasn't running yet.
When I try to use a percentage bar with the SceneManager.LoadSceneAsync, it gives me a quick percentage as the scene loads, but when I dismiss that, the PlacePeople.Start() and PlaceCars.Start() routines are then called, so we still have to wait. I had hoped it would not be loaded until all of the Start() routines were complete, but that is not the case.
When I try to place a canvas and UI in the scene, showing at start, and try to update the PB there, the whole scene loads and the the PlacePeople and PlaceCars runs before the Canvas is displayed.
So, how can I display a Canvas that can be updated from PlacePeople.Start() and PlaceCars.Start(), that will show while those routines are executing? I need the equivalent of DoEvents.
Was thinking Coroutines might be the way to go, but I think that puts it on a different thread, and I won't be able to update the values.
Any suggestions?
↧