How to interact with multiple meshes in one blueprint?

Hi,

I followed this tutorial on YouTube: “How to make an Interaction System in UE4 - Tutorial - YouTube” and where it’s been fine, the issue I’m having is that I’m not sure how to deal with multiple meshes in a single blueprint, I have a control panel blueprint which has many buttons in the same blueprint, the issue is that the way this blueprint works from this tutorial; when I click in the panel, it always activates the interaction, meaning it doesn’t matter which of the buttons I press it will always run the same blueprint, so to test it, I just used a print command to just say “hello”, and no matter what button I press, they all run that same blueprint, so I was wondering how I can separate it.

E.g., Mesh 1, Mesh 2, Mesh 3, how can I make those separate interactions? Instead of all of those buttons interacting at the same time.

EDIT: All right I get the point, firstly mentioning buttons created some confusion, I don’t know how it made it seem like UMG widgets when I didn’t mention that, I’m talking about the meshes being the buttons, and as mentioned they’re in the blueprint, a screenshot below to explain it, also my reason for showing the tutorial is because I literally copied it directly, I haven’t changed it in anyway as I’m still learning blueprint, but basically the first person controller contains some line trace code, which uses some blueprint interaction item, then in the blueprint of the control panel, when you click on the object using the line trace, it sends an interaction.

Control Panel Blueprint

First Person Controller

Content Browser

Control Panel Blueprint

I can’t explain anymore than this, as this is the only thing that was explained in the video tutorial, but as mentioned originally, the problem is in the part where you use the interaction, no matter what I click, it all sends the same print command, so I want to know how to separate it.

Hey, I really don’t want to watch a 17 min tutorial (before the 3rd morning coffee at least…) and keep guessing what might be going on between the tut & your setup.

Could you briefly describe what’s needed? Here’s what I understood from your description:

  • there is an actor
  • this actor has several static meshes
  • there is a widget with buttons created by this actor (or this actor has a widget component - unclear?)

What happens next, ideally?

  • we press Button1 and something happens to Mesh1
  • we press Button2 and something happens to Mesh2
  • or no?
  • what kind of interaction are we talking about?

How close am I getting?


Hopefully this question is clear.

And here’s what’s confusing:

it doesn’t matter which of the
buttons I press it will always run the
same blueprint

I thought there was only 1 actor (blueprint) - there’s more? Perhaps you mean that, currently, all buttons interact with the very same mesh, rather than each button having its own mesh to interact with assigned?

Do tell.

I totally agree, you follow a tutorial which we don’t need/want to check

You message is unclear, you have a (probably) UMG where you have your buttons overlay
Is this a Global UMG? I mean - you have 1 UMG created f.ex. from Level BP and it should contact with… what?

Or is it like - You have many BP’s and all of them contain the UMG?

To be clear: 1 UMG can obviously controll many different BP’s, the question is - how do you try to access them and how are they stored in the UMG?
-If you have a single variable to reference actually selected BP - it’s tricky and inefficient
-If you have an Array - it should contain all of the items you need so if you have issues - it’s just the code that gets wrongly the reference

Remember to add some screenshots for clarification - it helps a lot!

And regarding watching the tutorial - we could do this but you have your own project where you have to adapt everything and there come the differences which we don’t see - that’s why it’s pretty pointless

Please check the edit on the post

Nah. It’s all good - I just needed to wrap my mind around it so I could suggest something tangible. Now that I think about it, it should have been obvious from the get-go but I missed the point. All very clear now!


Consider the following:

  • we give each mesh a unique tag:

  • the interface accepts a Name variable

  • then in the actor owning the meshes:

  • and you’d call it like so


That’s 1 method, crude but effective. Tags can be inherited and can be added / changed / removed dynamically during gameplay, too!

it all sends the same print command,
so I want to know how to separate it.

Sure. But the approach and method would depend on what really needs to happen next - what kind of interaction. With no details, I can only suggest something VERY generic:

  • add a component to the BPI function, when the actor receives it, you will know which component it originated from.

There are too many ways of handling this, too many to list…


If you need a specific solution / suggestion, do tell what is supposed to happen once the actor receives the BPI message. Perhaps you want to use tags, perhaps we want a dictionary map, perhaps a static mesh dispatcher should be called… ¯_(ツ)_/¯

When you press a button (mesh) in the control panel, I want it to call an event, the event is already created, its more that I just wanted to know which of the buttons (meshes) was clicked, rather than no matter what I click they all respond, can I somehow separate them? E.g, if I click Mesh 1, Mesh 1 will run Event 1, if I click Mesh 2, Mesh 2 will run Event 2, this is at the very basic level all I’m trying to do.

Each static event has an event so perhaps all you need is this:

But if you must use a trace + interface, that’s a bit more complicated but perfectly doable with tags. Do tell if tracing is a must here - it might, you might be working with some kind of interacting component in VR for all we know…

Thank you for this, yes it does use a line trace, not for VR, but just general; using the default First Person Blueprint Crosshair.

Ah, now it makes sense - we’re pointing at the buttons from a distance. I’ll post something in a bit. Worst case scenario, tomorrow morning. Hang on.

Not too far in the distance if that makes sense, since its a control panel, its only when you’re within the range of it, but thank you so much for helping me through this, and I apologise for my frustration, I just struggle with explaining things, and in term I get a bit frustrated when I can’t explain it correctly, so sorry again

That’s done it, that’s the answer I was looking for, thank you so much for helping me with this, and I can see that it’s pretty simple too (kind of) (now that I can see it done, I just struggle a bit with logic, so when its laid out like this, it makes total sense) so I really appreciate this, thank you!