Blueprint Interface between BPs that do NOT touch or collide

So I know how to use BP Interfaces between a projectile and an object. For instance, if a projectile overlaps a trigger box of a Character BP, the projectile can use that collision event to make an interface call to the Character BP to fire an event in the Character BP. Got it. Easy. Understood.

What I don’t know how to do with Interfaces yet is involving two Blueprints, let’s say a Button (ButtonBP) and a Door (DoorBP).

If both are in different parts of the level, and I interact with ButtonBP, I want to make an interface call over to DoorBP to tell the DoorBP to open up.

I do NOT want to use the GetAllActorsOfClass node because I’ve been warned that that can get clunky because all of those actors are actually loaded into the scene when the level starts.

So my question is, how do I use BP Interface to communicate between two Blueprints if they do NOT overlap, and without using GetAllActorsOfClass?

Somehow, I have to have some “object” for the interface call to reference. All of the examples I’ve seen have used either “GetPlayerCharacter” (which I don’t need to communicate with) or use an overlap event to get the overlapped object, which I don’t have.

Last time I wanted to do this, I cheated and put a trigger box in DoorBP and moved that trigger box to the ButtonBP location, just so that I could get an overlapping actor to reference when making the interface call. I just think that’s a dumb solution.

Anyone have any answers?

You just make a variable in the button, which is a reference to the door, make it public and assign it in the level:

Incidentally, if the button KNOWS it’s a door ( it’s a door reference ), that totally defeats the point of using a BPI.

You can do it one of two ways:

  1. The button knows it’s a door, and might as well call the Open custom event

  2. The button just has a variable of type Actor, and knows nothing about it. Uses a BPI to call ‘Interact’ on the door. The service call in the door for Interact, responds by opening.

This is the difference between tight and lose coupling. Lose coupling is usually better.

Because it’s a BPI you can make the Interact call on ANY actor. Many actors won’t know what to do with that event, but that does not matter.

This is how you can build up totally general interfaces using BPIs, because you can have a call like ‘Interact’ which can mean many things to many different kinds of actors.

I feel so dumb now, but every day I learn something new so I guess I have that going for me.
Thank you so much for taking the time to point that out. Of course, makes total sense.

1 Like