Communication between Level and sublevels

Hi!
I created Level - MainLevel and many sublevels. In MainLevel blueprint, under certain conditions I load/unload sublevels. Then I want to start listen on some events that happens in loaded sublevel, and stop listen on events if sublevel is unloaded. I tried use “Load stream level by name” , and “Get loaded level”, but i can’t get reference to sublevel’s level blueprint. Is only way to achieve communications betveen level and sublevel is use GameStateBase (GSB)? In this case GSB will be works as a “proxy”:

  • GSB create EventDispather,
  • MainLevel bind to this dispather
  • sublevel send data to GSB
  • GSB call EventDispather

Is it ok? Is there any better solution to this problem?

I don’t think you can directly reference a level blueprint. But you can add blueprint interfaces to reference/call functions on these level blueprints.

Have an array of Blueprint Interfaces “BPI_LevelBP” where your levels have access to.(GameState/GameInstance/PlayerController?) Maybe 1 Ref for main level and 1 array of Refs for sublevels. And on each level’s BeginPlay & EndPlay do add & remove to the array. Implement the interfaces so that your levels can communicate through them.