Wait for scene spawn to finish before next state #4040
Unanswered
marko-lazic
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I have never loaded a scene myself, so I'm on pretty thin ice here, but I figured a half-informed answer is better than no answer. :) I believe asset loading is asynchronous by default, so you probably try to count the vortex nodes before the scene has actually loaded. I can think of a few possible ways of solving this:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There is a situation where I need to know a final number of entities before doing additional world post-processing.
In the example below, we are loading scene assets from a file. After we load and spawn the scene the game state is being changed. What I expected is that states are hard sync points and that when moving from one to another all threads in the current state finish, before systems start the next state. But this is not the case with this example. I expected that the query counts 3 entities but the query is empty and it seems that scene has not finished spawning yet.
Output - expected 3 vortex nodes but it counted 0
universe.scn
I know that everyone pretty much compensates with Added filter but I have to know a finite number of entities before going into the next state. Does anyone have an idea how to solve this? Looking at the bevy_scene it looks very simple. Probably there is some integration lacking between scene and system sets. I want to hear your opinion, ideas on what could be added on a long run, and how to overcome this problem in the short run?
Beta Was this translation helpful? Give feedback.
All reactions