# Interface Usage

**URL:** <https://forums.unrealengine.com/t/interface-usage/1155521>\
**Category:** Getting Started & Setup\
**Tags:** unreal-engine\
**Created:** [May 5, 2023, 3:40pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521 "2023-05-05T15:40:57Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![EvilGeniusTC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilGeniusTC](https://forums.unrealengine.com/u/EvilGeniusTC)\
**Post date:** [May 5, 2023, 3:40pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/1 "2023-05-05T15:40:58Z")

</div>

So somehow, I’ve only really started using Custom Events and Event Dispatchers recently. Game Changer! That being said the real shortcoming I’ve found is that they only work on that BP. I’ve been using Interfaces purely as a means to pass variables but would I be correct in my new assumption that the real power comes from basically allowing you to have Event Dispatchers that can notify other BPs?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 5, 2023, 4:12pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/2 "2023-05-05T16:12:56Z")

</div>

> [@EvilGeniusTC](#):
>
> the real power comes from basically allowing you to have Event Dispatchers that can notify other BPs

Aye, the power comes from the fact that you do not need a reference once they’ve been registered. You can register now, Once, pay the price and keep calling later for free.

Sending an interface message to 100k actors is very expensive. Dispatching is cheap and you no longer need a reference.

> the real shortcoming I’ve found is that they only work on that BP.

Nah, you can register from any actor to any other actor - one of the most powerful features. And it does not need to be an actor, it can be a widget → component communication.

You often end up with managing classes that bind unrelated actors without those actors ever knowing that the other one exists; +1 for decoupling.

- actor component in some actor:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/e/4/0e488ab1d1360bb59077e4d850241ca7d809776a.png)

- actor component in another actor:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/e/0/fe0357a31572a3388d0552d8315b95a35503c772.png)

- the actor component A can now talk (call a dispatcher) to B:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/6/c/c6c1fe7fc28f1cb5faada26b0b609bcf0d07dcba.png)

And if after 30 minutes of gameplay one of the actors gets destroyed… nothing will happen.

* * *

Another example:

I have 400 trees in the scene, I need the player controller to know when 3 very specific trees get chopped down:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/5/2/a5240ca0c7850d7d707a75e429d553dbafe76c4c.png)

* * *

You will need / use all 3 methods of comms anyway + inheritance. Choose the best tool for the job at hand.

---

<div class="post-metadata">

**Author:** ![EvilGeniusTC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilGeniusTC](https://forums.unrealengine.com/u/EvilGeniusTC)\
**Post date:** [May 5, 2023, 4:39pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/3 "2023-05-05T16:39:17Z")

</div>

How do I go about accessing them in a different BP? Here is my current setup…

This is BPa where the original dispatcher was created. The Print String works.

 ![Screenshot 2023-05-05 123335](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/4/6/a46f057854f23a2801212eda91777ceee932f361.png)

This is BPb which most likely is incorrect but its where my head is at. The Print doesn’t fire. TurnBasedGameMode is where the orginal dispatcher is as well.

 ![Screenshot 2023-05-05 123408](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/0/9c04fe38a82de3bc7a37e7711bfd6bfae6144d2d.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 5, 2023, 4:43pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/4 "2023-05-05T16:43:52Z")

</div>

> How do I go about accessing them in a different BP? Here is my current setup…

We need to know what it is, where it is and how the different BP actor makes into the game. You need to obtain a reference somehow.

> [@EvilGeniusTC](#):
>
> This is BPb which most likely is incorrect but its where my head is at. The Print doesn’t fire.

This looks fine. How are you calling the dispatcher? In this example, the Game Mode has the dispatcher and talk to the actor we see.

---

<div class="post-metadata">

**Author:** ![EvilGeniusTC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilGeniusTC](https://forums.unrealengine.com/u/EvilGeniusTC)\
**Post date:** [May 5, 2023, 4:46pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/5 "2023-05-05T16:46:35Z")

</div>

My assumption was that the call start that makes the print string in BPa fire would fire off the bound event in BPb.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 5, 2023, 4:47pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/6 "2023-05-05T16:47:43Z")

</div>

And you’re assuming correctly. So how does the Game Mode call it?

- the game mode calls:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/2/a724f3a65ebd132e10a5f1b7e9d65002a51c2fb9.png)

- and every time it does, this actor will hear about it:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/e/1fec86c83cbd54b0d1d12e7740ed20c6cda41820.png)

You could have 100 of actors like this, all will listen to the call.

---

<div class="post-metadata">

**Author:** ![EvilGeniusTC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilGeniusTC](https://forums.unrealengine.com/u/EvilGeniusTC)\
**Post date:** [May 5, 2023, 4:52pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/7 "2023-05-05T16:52:23Z")

</div>

Unless I’m missing something that’s essentially my same setup yet the print string on BPb does not fire for me.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 5, 2023, 4:53pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/8 "2023-05-05T16:53:07Z")

</div>

Could you show how the GM calls it? What triggers the call?

---

<div class="post-metadata">

**Author:** ![EvilGeniusTC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilGeniusTC](https://forums.unrealengine.com/u/EvilGeniusTC)\
**Post date:** [May 5, 2023, 4:54pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/9 "2023-05-05T16:54:53Z")

</div>

BPa is TurnBasedGameMode and BPb is TurnBasedGameState

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 5, 2023, 5:02pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/10 "2023-05-05T17:02:39Z")

</div>

Should work fine unless you used Begin Play in the Game Mode - the Game State does not exist yet (or, to be more precise, has yet to register).

That’s why I keep asking **how** you’re calling it. 😇

---

<div class="post-metadata">

**Author:** ![EvilGeniusTC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilGeniusTC](https://forums.unrealengine.com/u/EvilGeniusTC)\
**Post date:** [May 5, 2023, 5:19pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/11 "2023-05-05T17:19:11Z")

</div>

That’s it… GameState doesnt exist yet… would it work if i added a delay?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 5, 2023, 5:39pm UTC](https://forums.unrealengine.com/t/interface-usage/1155521/12 "2023-05-05T17:39:01Z")

</div>

Yes. 99% yes. It probably exist but has yet to fire its own begin play.
