I am trying to implement a button, which can destroy the actor it is conected to.
right now when pressing the button it can destroy an actor of the blueprint class but not specificly the one I am in the hitbox of.
Can somebody please help me? I am new to Unreal and at some point where I have no idea what to do anymore…
Those BP interface calls can have parameters, like this:
Why not pass a reference to the actor you have just overlapped with to the kill routine?
basically that is what I tryed when I set the “current” object variable in the interactive Object Blueprint. But now I don’t know how to call it at the button interaction.
No. You have a couple of problems there. Firstly, the you’re setting the current object to the first person character
You need to set the current object to ‘reference to self’. It’s the current BP_interactive object this code is being run in.
Second, you have to pass it to the BP interface call as a parameter. Go to the place where you setup that BP interface ( show popup ) and add a parameter which is a reference to a BP_interactive object.
Then you can pass it with the call.
Also, the more usual way to check if it’s the player causing the overlap is:
Of course it’s ok to do it your way, but this is usually what you’ll see. And it’s a bit less cumbersome.