Need help to get an object to respond when pressing a button

Hi there,

I am having some trouble with blueprints at the moment. I have been trying to create an object that will follow the player around and when a button/key is pressed, let’s say f, it will attack another object and destroy it. At the moment I am not too concerned about the object following the player or attacking another object, it is actually trying to get it to respond when I press f that is the problem.

I created a new project using the third person template and then created a class blueprint for the object because it will eventually have it’s own animations and sounds. After a lot of experimenting with trying to get a message onto the screen by pressing f, I found that I cannot press f and put a message on screen within the object class but I can within the character class.

Is there a way that I can get the player to press f and it takes the information from the object class, rather than having to set it up in the character class?

Any help would be greatly appreciated and I hope that I have explained my problem well enough.


Just to be clear, you mean object in the sense of a thing in my world (which in Unreal is usually referred to as an Actor) and not something that inherits from the Unreal Object class?

Assuming that is the case, then the reason your Character responds to input and your Actor does not is because certain Actors are set up to Enable Input by default (the Character, PlayerController, and LevelScript being the main ones). You can either call EnableInput from the Begin Play event inside your Actor or set it up to Auto Enable Input from the defaults.

If you want text on or near an object you can add text as a component in it’s blueprint, then you can simply use the “visibility” toggle node to make it visible or not visible when you press F.

Hope this is what you’re after, if not let us know.

Hi guys thanks for replying.

Yes I did mean Actor instead of Object sorry about that. I have tried setting it up as a Character before I posted on this forum but it didn’t work, I also tried the BeginPlay Event and EnableInput but that didn’t work either. I will try again, just in case I missed something and will also try to set up Auto Enable Input in the defaults.

I think the best way to explain what I am trying to achieve, is to think of the Aku Aku Mask in Crash Bandicoot, I want it to follow the player around but I also want to allow the player to tell it to attack or retrieve something. Would it be better to set it up as another Character?

Aku Aku Mask.jpg

Thanks again.

Ok so I’ve just been thinking and reading through some more documentation, would I use a PlayerController to control both the Character and the attacking Actor? If so I have just found this: “By default, there is a one-to-one relationship between Controllers and Pawns; meaning, each Controller controls only one Pawn at any given time. This is acceptable for most types of games, but may need to be adjusted as certain types of games - real-time strategy comes to mind - may require the ability to control multiple entities at once.”

So how would I change it so that the player can control multiple entities?