Help getting player-activated buttons to work?

Howdy! Nice to be back.

Well, it’s not all nice, since I’m here with a problem. I’ve made a button blueprint that can be activated when the player presses a key, and this should really be the simplest thing in the universe, but I’m stuck.
I can put one of these buttons in the level and it will work, but when I put two or more things get wonky. The player can only activate whichever button was placed in the level last. The other(s) stop working.

I think this is because I need a reference to the button in my player blueprint, which I set in the Begin Play node of the button:


Over in the player’s blueprint, a Line Trace is made every time you hit a certain key, and if that trace connects with something that matches the button reference, we tell it to activate using a Blueprint Interface.

I swear I’ve done this before and I didn’t run into this particular issue, so I’m flummoxed.

The button shouldn’t have to know about the player, nor the player know about the buttons. I assume your interface has a function that the player calls on the button class? When you do your line trace in the player character class, after checking that the returned actor is valid, use the Implements Interface node, set to your interaction interface. If that returns true, you can then call the interface function on the returned actor, without needing to know anything more about the actor.

I just knew I was overthinking it. Thank you, everything works smoothly now.