Event Dispatcher Target Issue

Good day all,

I have yet again come to a position of confusion. I am attempting to use Event Dispatchers with no success.

The real struggle I am understanding is the ‘target’ input. All the tutorials I have watched ignore the question of what the ‘target’ is.

At some point, I understand it to be the object that we are calling and listening to/from. But I try to reference the blueprints, it is being rejected as non-compatible.

**Concept:**
I have the following concept to try to achieve. I wish to have an actor activate on multiple different actor parents. (a cannon attached to a ship). I would like the ability to add as many cannons as i want onto any different type of ship. so I am trying to attached a spawn event on the cannons.
I also have my controller inputs as a seperate blueprint, so that if the ship archetype was to change, the controls would be the same.

I am trying to modulate with efficiency.

**Action:**
I have a controller BP with a mouse click to shoot. after a certain test, i want it to sent a signal to any cannons controlled by the player.

the cannons are an actor BP and are attached to a ship actor.

My issue is, when i bind the cannon dispatcher, I see the call so the call works. But for the life of me, cannot understand the ‘target’ input.

**Summary:**
The call is from a ‘player controller class’ and the bind is on an ‘actor class’.
Any help would be great. a guide to understanding this node would be fantastic. (most guides ignore target input)

1 Like

So I made a player controller with the dispatcher in it

That’s me calling it. You don’t need to assign the Target pin.

In the cannon BP, we have

So it just binds to the dispatcher in the PC.

just had to add the cast to ‘myplayercontroller’.
But I was sure that casting was a memory managment problem?

1 Like

Nope :slight_smile:

Casting on tick is not good, but apart from that it’s fine.

1 Like

The “problem” with a cast is not the cast itself but the type you cast to.
It is very easy to add all kinds of type casts to all kinds of Blueprints and suddenly end up with a web of dependencies that will result in referencing one type you suddenly load 99.9% of the project.

Before you start to worry about this issue you got to ask yourself if the type you cast to is already expected to be referenced/loaded elsewhere since then the cast is essentially free. Generally speaking many Blueprints referencing one particular Blueprint is totally fine and is what normally happens when you have an Event Dispatcher.

If you want to see how deep the rabbit hole goes just open the Reference Viewer window.

Cast Types is not the only thing that introduces dependencies though. Typed reference variables, Function/Event parameters and parent classes also count.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.