A question about BP INTERFACE!

Hi! I have a misunderstanding if I use the same interface for two actors but with different events.

For example, I have two actors (A and B) with the same interface and a Character.
From Character I call an interface event (Event_A) from Actor A, and from Actor A I call another interface event (Event_B) from B.

Is it right if I have this situation? It works perfectly, but I don’t know if there are any chances of creating bugs or others.

1 Like

If you’ve made an interface, you can call it on ANY actor. That’s the point :wink:

Make sure you use an actor type reference, not the type of the object.

Your example sounds a bit like you’re just calling events from inside the other blueprints?..

1 Like

From Character I have a Line Trace to find the reference of Actor A and call its event, from Actor A I have a Box Collision that finds the reference of Actor B and I can call its event!

Right, no problem.

But if they both have different events, it’s not an interface.

Maybe you can show a bit of code?

It would look like this

and this

image

By “events” I mean that in the Interface I have two different functions that I use as events. One function for actor A, another for actor B.

That’s not what an interface is for :slight_smile:

If you have to find out what kind of things they are before you make the call, you’ve lost the reason for using an interface.

yes but in the first actor i use another function/event for the second actor.

1 Like

You can only do that if you know what kinds of actors they are. Then there’s no point in using an interface :frowning:

It sounds like you need to use the same interface events in both actors?

That’s the point of interfaces. An event called ‘use’ means a different thing, depending on if you are a

door
football
gun
book

They all implement ‘use’, but what they do with it is totally different :slight_smile:

no… look



it doesn’t matter what I use them for, I want to know if there would be any problems if I do that.

I don’t see any problems :slight_smile:

They can all implement all events, if you want…

1 Like

that’s what I wanted to hear :))

1 Like

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