Hi,
I just have a question that I’ve been a little curious about and haven’t really found a “clean” solution to. Let’s say I’m using level streaming and in one level, I have a button and in the other level I have a door. The button has a public reference to the door and when the button is pressed, in the button blueprint, it unlocks the door by using the reference to the door and changing the door’s boolean state from locked to unlocked. When I try to get a public reference to the door in the public drop-down options, the door shows up but when I click on it, nothing happens. I understand that it’s because it is outside of the level, but is there a way to get a reference to the door publically besides using a “get all actors” function or something similar to that like casting? Or is that really the only “clean” way of doing it?
Hm, I don’t have a solution exactly but I did have a thought. Did you need to have the button unlock the door specifically? Or could you have a list of “keys” which are the references/ids of the things they “unlock”. You could have it that when the level loads it checks the player’s list of keys and updates all the doors when they load. Another idea is when the player goes to use the door, if the door’s id/key is in the players list then it unlocks and opens.
Just an idea.
Have a bool in a persistence place both the button and the door have access to. All the button will do is toggle that bool, it does not have to know the door exists. When the door loads, it just checks that bool and updates accordingly.
For example:
The button:
The door:
The result:
Well in my case, I’m not using a door button situation; but this still applies to that situation. I basically have a “Game Manager” actor that just holds values and is placed in my persistent level. Let’s say I have an actor in a sublevel that references to the Game Manager publically, I can’t actually get a reference to it unless I use a get all actors of class function and add it to an array and loop through that and get a reference that way.