# How to send interface messages to individual NPCs from UI Widgets without hardcoding references?

**URL:** <https://forums.unrealengine.com/t/how-to-send-interface-messages-to-individual-npcs-from-ui-widgets-without-hardcoding-references/2586679>\
**Category:** Blueprint\
**Tags:** interface, unreal-engine, question, Blueprint\
**Created:** [July 1, 2025, 2:59pm UTC](https://forums.unrealengine.com/t/how-to-send-interface-messages-to-individual-npcs-from-ui-widgets-without-hardcoding-references/2586679 "2025-07-01T14:59:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![e7de84f7c71249dc8a21a7d1f05899f3](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/e7de84f7c71249dc8a21a7d1f05899f3/32/1063469_2.png) [@e7de84f7c71249dc8a21a7d1f05899f3](https://forums.unrealengine.com/u/e7de84f7c71249dc8a21a7d1f05899f3)\
**Post date:** [July 1, 2025, 2:59pm UTC](https://forums.unrealengine.com/t/how-to-send-interface-messages-to-individual-npcs-from-ui-widgets-without-hardcoding-references/2586679/1 "2025-07-01T14:59:06Z")

</div>

![スクリーンショット 2025-07-01 235234](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/f/24f940c9363a19414857acc7f90e09d0ca2eda1c.png)  
 ![スクリーンショット 2025-07-01 235114](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/9/5/6957d47358397581bf425e175643d6643e2fdbf1.png)

Hi everyone,

I’m working on a dialogue system using Blueprints in Unreal Engine, and I have a question about communication between a UI Widget and NPC actors via a Blueprint Interface.

Here’s the situation:

- I have a **Widget Blueprint** that contains buttons.
- When a button is clicked, I want to **send a notification to an NPC** using a Blueprint Interface function (e.g., `StartDialogue`).
- I’m avoiding using `Get All Actors of Class` or `Cast To` for performance reasons.
- I understand that I need to **set a reference to the target NPC in the widget** , but I’m not sure what the best way is.

Currently, if I **manually assign a specific NPC reference** to the widget (like by name), then **all duplicated widgets will send the message to the same NPC** , which is not what I want.

What I want is:

> When a widget is created for a specific NPC, it should only communicate with that one instance of the NPC.

### ❓ My question is:

> **What should I set as the target reference in the Widget so that each widget talks to only one, specific NPC instance—without using `Get All Actors` or hardcoded names?**

Any best practices or clean solutions for this kind of setup?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [July 1, 2025, 6:01pm UTC](https://forums.unrealengine.com/t/how-to-send-interface-messages-to-individual-npcs-from-ui-widgets-without-hardcoding-references/2586679/2 "2025-07-01T18:01:59Z")

</div>

You do need a reference, but the point with blueprint interfaces, is that can be an actor reference.

If there’s a widget for each NPC, why not get the NPCs to create their own widget?

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [July 1, 2025, 6:33pm UTC](https://forums.unrealengine.com/t/how-to-send-interface-messages-to-individual-npcs-from-ui-widgets-without-hardcoding-references/2586679/3 "2025-07-01T18:33:16Z")

</div>

As @ClockworkOcean said, you need at minimum an actor reference. You can get that by simply line trace pinging them when you interact. Use hit actor from the result.

---

<div class="post-metadata">

**Author:** ![e7de84f7c71249dc8a21a7d1f05899f3](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/e7de84f7c71249dc8a21a7d1f05899f3/32/1063469_2.png) [@e7de84f7c71249dc8a21a7d1f05899f3](https://forums.unrealengine.com/u/e7de84f7c71249dc8a21a7d1f05899f3)\
**Post date:** [July 2, 2025, 3:12am UTC](https://forums.unrealengine.com/t/how-to-send-interface-messages-to-individual-npcs-from-ui-widgets-without-hardcoding-references/2586679/4 "2025-07-02T03:12:42Z")

</div>

Thank you very much!

In my setup, the content displayed in the Widget differs depending on the NPC. So, I used a Blueprint Interface (BPI) to send that Widget information from the Widget to the character.

At that point, the character’s BPI already had a reference to the NPC’s actor, so I promoted that reference to a variable in the character blueprint.

Then, I sent that actor reference variable from the character back to the Widget, and used that reference within the Widget to send notifications to the correct NPC.

Looking back, I wonder if that process was inefficient.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [July 2, 2025, 4:25am UTC](https://forums.unrealengine.com/t/how-to-send-interface-messages-to-individual-npcs-from-ui-widgets-without-hardcoding-references/2586679/5 "2025-07-02T04:25:45Z")

</div>

> [@e7de84f7c71249dc8a21a7d1f05899f3](#):
>
> Looking back, I wonder if that process was inefficient.

interfaces are more about reusability than efficiency, so if you plan to reuse the widget on different classes then its a good idea

---

<div class="post-metadata">

**Author:** ![e7de84f7c71249dc8a21a7d1f05899f3](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/e7de84f7c71249dc8a21a7d1f05899f3/32/1063469_2.png) [@e7de84f7c71249dc8a21a7d1f05899f3](https://forums.unrealengine.com/u/e7de84f7c71249dc8a21a7d1f05899f3)\
**Post date:** [July 2, 2025, 6:30am UTC](https://forums.unrealengine.com/t/how-to-send-interface-messages-to-individual-npcs-from-ui-widgets-without-hardcoding-references/2586679/6 "2025-07-02T06:30:29Z")

</div>

> [@Auran131](#):
>
> interfaces are more about reusability than efficiency, so if you plan to reuse the widget on different classes then its a good idea

That’s true, avoiding hard references is another goal.
