World Composition: Event when a level is loaded (C++)

Hello,

I’m trying to build some kind of data driven game (with NPC’s and such). I’d like to spawn NPC’s only when their level is loaded.
I’m using world composition (needs to be some kind of open world game).
But i’m not seeing any event noticing me that “hey, this level has loaded now!” and “this level has unloaded!”
Does this kind of thing exists?
Or that implies that i’m doing the loading stuff myself?
(I mean, without adding code to every single level to trigger that…)
Thanks !

Flem

Hey, you could simply hook on your GameMode code “BeginPlay” it’s called when the world is initialized

else if it’s with level streaming, you can use these events ( can be hooked in beginPlay Aswell i guess ) :

	ULevelStreaming* level = UGameplayStatics::GetStreamingLevel(GetWorld(), *MapName);
	level->OnLevelLoaded // with AddDynamic
	level->OnLevelHidden

Yeah but this only procs when the whole level is loaded, not every sublevel?

the begin play will be triggered at the beginning of the game ( so when all persistent levels are loaded )

for the second part, it’s related to each sublevels, you would need a list of sublevels name to iterate on that and register event for all sublevels