I would like to have a persistent level (PL) with a couple of sub levels (SL) that are always loaded. I would like to know if there is anyway for one level to communicate to another level to begin execution of blueprint functionality. I tried adding a delegate to the PL and then assign/bind the event in the SL. The BPs compile, but attempting to save the level results in a complaint that I’m accessing a reference in another level - so apparently an SL cannot know about a PL and delegates are less generic than I assumed. Attempting to go the other route (maybe a PL can know about it’s various SLs) resulted in a compile failure for the assign/bind within the PL.
Ultimately what I’m trying to do is have the PL execute some BP code until it reaches a point where I want it to send an event to some of the SLs to begin executing. I’m an UnrealEngine noob, so what am I failing at here?
As noted above, all the SLs would always be loaded. Additionally I don’t want the call to occur at level load. I want the PL to execute the delegate after a certain amount of time has passed or maybe a certain event (such as the player entering into an area) in the level. The point of all of this is allow for multiple designers to work on a single level at the same time. The PL would be the main map and each SL would be a specific designer’s map so that they can work on specific functionality at the same time that they can view the others’ locked maps. I just need a few PL delegates to sync certain events across multiple maps.
You must use the Persistent Level’s Blueprint to cross communicate between sub-levels. That you will ve allowed to save the map files without any warning.
As I noted above, I was not able to use the PL for delegate communication - what am I failing at here?
Are people using delegates in their GameInstance as the means to communicate across multiple loaded levels (PL and SLs)? Seems to me there should be a better way to do this - which is why I was pursuing the PL/SL method, but unfortunately without success.
You can do this by implementing a Blueprint Interface, and telling your sublevel to use it.
Here’s an example:
Say I want to call a function in sublevel Foo_Lighting from my persistent level Foo_P:
Create a Blueprint Interface, and in this interface, declare the function I want to call:
Now, in the sublevel that should receive this call, open Class Settings > Interfaces > Implemented Interfaces, and add the new Blueprint Interface we just created.
Back in your Event Graph, you should now be able to create an event using the signature of the call you defined in your interface:
Now, from within my persistent level, call GetStreamingLevel with the name of your sublevel as its Package Name, and call the function you defined in the Interface.
Use a RemoteEvent node and write the name of the event on the other level and I think name has to be unique project wide. That’s it
Yes - if you don’t need to pass any arguments, this approach will work.
To do this, just put a RemoteEvent node where you’re making the call, entering an event name as the argument.
In the destination Blueprint, create a Custom Event with the same name.