Not exactly sure what you’re asking, but I think what you’re looking for is an interface.
An interface is basically a layer placed on top of a blueprint that defines what functions are available. The purpose is multiple blueprints can implement the same interface, then when you wish to access it, you simply try to access that interface function.
Here’s an example. Let’s say you’re making an adventure game and there’s lots of objects in the world the player can interact with. So when the player presses “E”, you run a line trace to see what the player is looking at.
Now, in order to interact with the object, you could do
Character Blueprint:
Press e > --------- > Single Line Trace, Break Hit -------> Hit Actor
With a long series of branches to see if the actor is a light or a lever or a button or a door… it will get messy fast.
All of those objects (light, level, button, door) all have one thing in common: They can be triggered by the player. This is where an interface can come in handy.
If you right click in the content browser and create a new interface blueprint, you can call it something like “Interaction”. Add one function to the event graph, call it “Activate”. That’s it - the interface is done (unless you wish to make it more complex later).
Now you’d go to each one of your objects, let’s say the light for example, and in the blueprint properties, add the Interaction interface.
In the light’s event grid, right click and add the “Activate” event. It will be available now because you added the interface.
Now in the character blueprint, we don’t need to have all those branches anymore.
Press e > --------- > Single Line Trace, Break Hit -------> Hit Actor --------> Activate
That’s all you need now. So the logic is as follows
- Player presses “E”
- A trace is run to see what the player is looking at
- If the trace hits an actor, attempt to run the “Activate” event on that actor
- “Activate” event is called on the light
So any object that uses the “Interaction” interface can use the “Activate” event. The interface defines that function so that the character blueprint really doesn’t care what kind of object it is… it doesn’t need to know if it’s a light or a box or a lever, etc. It just tries to use it and the object itself can define it’s “activate” behavior.
I realize I’m not great at explaining things, but I tried. Hopefully it helps.