How to Optimize an Interaction System in Blueprints?

Hi All, I am new to unreal and I have been struggling with creating an interaction system on a set of drawers (BP with multiple SMs).

I have created a Actor Component that deals with the line tracing and setting a trace Area for the outline. This is attached to the Main Character and when the character interacts with a set of drawers it outlines the individual drawers and I have the widget shown in the centre of the SM like so:

I have got this working, by creating the Draws as separate BPs and I have positioned them in place:

Capture

I can see, though it works, this is very labour intensive and I can’t see away of doing this dynamically and lower the total overhead.

Is anyone able to help?

1 Like

One of the main ways to gain efficiency is by using blueprint inheritance.

Once you’ve written a parent blueprint with you can interact with, you can generalize it by just adding more meshes ( mesh components ) to a descendant.

So, this chest would be a desendant of the parent BP, you would have marked the draws as interactive ( how you do that really depends on how the parent is written ), and the movement code for the drawers is the only ‘local’ thing here.

Everything happens in the parent BP, including the highlighting. The only thing in the player, is the line trace.

1 Like

Thank you @ClockworkOcean. I understand inheritance (I have come from a Java Developer Background) but new to unreal, so I will take a look at this video.

If I am understanding what you are saying, is to create a BP_Master (not a great name), which contains the logic to show the widget, the outline and the duration of the interaction for example. You would then create a BP_Drawer which is a child of the BP_Master which contains the SM_Drawer and the 6 SM_Draws?

If so, the only part I am not getting is how would you target the individual SMs as you focus on them via the Trace by Channel which is within the Actor Component?

I have added my Trace Function from within the AC. Is this not a good place to put it, but within the Master Blueprint instead?

Personally, I would make BP_chest. It’s an interactable BP.

Everything common ( highlight, timelines, responding to blueprint interface ) goes in the parent. Only specific stuff goes into the child.

You can tell it how to move one drawer, then just have an array of drawer references.

I’d keep all the widget stuff totally separate. Yes, call it just once from the parent, to get it going, but then keep it apart.

When you do the line trace, you also get the hit component, this will be a drawer ( in this case ).

The line trace lives in the player.

@ClockworkOcean Thank you, I will give this ago

1 Like

Tell me if you get stuck, it’s not obvious sometimes :slight_smile:

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