Why after OnLevelLoaded, "Get all actors of class" function will not work in the same frame?

Hello, when I receive the OnLevelLoaded callback if I call “Get all actors of class” it doesn’t work, always returns 0 actors. I have to put a Delay node, and then it works.

Can anyone explain me why this works after the delay? Is it designed that way or I’m missing something?

Example of what I have to do: (it seems awkward…)

1 Like

message edited .

Because as soon as the level is spawned the actors in the level arent spawned yet. Level Spawned > Actors spawned in level one at a time. Although this process happens almost so quickly one might think it was all done at the same time. The delay node will work fine though.

Ok but, for me this seems awkward… why the level spawned callback is called if the actors of the level aren’t loaded yet… ??

Im not expert on the engine stuff behind doors, but I think its because technically the level is loaded.

actors are constantly loaded in and out, therefore the level is never ‘fully loaded’

I think the way it works under the bonnet is to imagine that your level is like a parent blueprint class for everything in the scene. As soon as the level is initialised, your event will fire. However that doesnt mean every tree, rock and wall is loaded in yet.

Then, how can I know that my level (actors included) is loaded and that I can start to posses my player etc … etc…? The delay of 0.5s works for me, but that doesnt means that in other PC’s will work, this is very strange for me but thank you!