Download

Change a Bool in a BP which is in a Sub-level from the persistent level

I kinda had this topic for some 2 3 hours nobody answered , but I found some documentation and I thought I fixed the problem but… now UE4 crashes each time when I use my “solution” so yeah here I go again.

The situation so far…

PodBP has custom var bool DaVar which controls a branch

PodBP is in Level_1

Level_1 is in Level_world ( persistent )

I want to change DaVar from Level_world can this be done ?

Yes.

Something like this to do it:
Make sure it is public (click the closed eye, so it’s open).

Then in your level BP loop through all actors of your PodBP class, if you only have one, get the first and pull the setter off it’s pin for the DaVar variable.

Should I call an event to change it from inside PodBP OR should I just SET>DaVar

Edit:
In the persistent Level BP:

When I SET DaVar I get an error (accessed none…) and nothing happens

When I call a function “ChangeBool” inside PodBP NO error and nothing happens

the way I do it now is I create a var in the lvl BP and assign PodBP to it. Also all my vars are Editable and exposed at spawn .

Is it a class variable that you have in your level bp? It should be working if you have a valid reference to your PodBP class and the variable bool in that has been made public.

You can try to search for the term, Blueprint Comms. BP’s can access each others variables.

well if i isolate 1 Sublvl and add the references PodBP to its LevelBP it works. BUT this will mean i will have to trigger the trigger inside the sublevels somehow from the persistent lvl.
( I tried referencing them inside the Level_worldLevelBP and I get external package error and cannot save)

When i try to add references to PodBP to Level_worldLevelBP I can’t , im sure its because the BP’s are inside Level_1

Can you post a screen-shot of your Blueprint graph, including the variable, plus have the detail open on the PodBP reference?

Here I go

http://fc07.deviantart.net/fs71/f/2014/092/8/0/q1_by_zerodollarz-d7cq5kk.png

http://fc03.deviantart.net/fs71/f/2014/092/6/d/q3_by_zerodollarz-d7cq5ks.png

http://fc06.deviantart.net/fs71/f/2014/092/8/7/q4_by_zerodollarz-d7cq5kv.png

They all don’t work. I tried referencing the class (the purple things) but they don’t show the function.
Also I want all the BP to change their function not just the “selected ones”.

It looks like the problem is that you’re trying to use the main persistent level (Lvl) to communicate with something in your sublevel. You can’t do this directly in blueprints yet, but we’re working on it! The issue you’re having is that even though you set the variable, since it’s loaded in with the Load Streaming Sublevel call. It doesn’t exist when the map is loaded, so it gets set to none. Any reference to objects in a level need to be made in the level script that owns the actor. So, in your case, the script would need to be in Lvl_1. Here’s how you’d hook this up:

  1. Open up Lvl_1’s level blueprint.
  2. Select the Escape Pod in the level viewport
  3. Right click in the level blueprint, and select “Add reference to EscapePod”. That will plop down a reference to the escape pod.
  4. Drag off the escape pod, and call your function, or set your variable directly (there should be no difference if the variable is exposed). Hook this up to a custom event in the event graph (e.g. “SetCrashDetected”).
  5. Open up Lvl’s level blueprint, and add a “Remote Event” node where you currently try to call “Change Bool” in your screenshots above. Tell it to call “SetCrashDetected”. What this does is search any loaded levels (Lvl_1 in your case), and look for any functions called “SetCrashDetected,” and calls them

That should do what you need. Again, we’re working on making this better using cross-level references, and being able to access other level scripts for streamed levels more directly. But for now, that should get you through!

Thank YOU this really works :slight_smile:

Ps
also I had a problem with 4.0.2 after the 4gb update today(one day after i updated and used the engine for good 7-8h) my physics pawn was moving all over the place with no input in it , and after the engine got an 80 mb update it fixed itself … no idea what went wrong…

Sorry to dig up this thread, but has the functionality for communication between persistent and sub level blueprints been implemented? I’m in a situation where I need navlinkproxies in the persistent level only to be enabled from when some logic happens in a sub-level blueprint.

Ok, what worked for me doing ref to BPs and other things was making a game mode ref and then before I run my logic and functions, I check the game mode first and if not valid, do the same logic but use the “get all of class”