Weapon (as child actor) not taking input events

Hi there,

I started playing around with UE about a week ago so please bare with me in case I’m just missing something obvious.

So here’s the thing. I’m using the Third Person example project to create a simple Third/First person shooter game.

So at first I was adding the gun’s mesh to my character’s blueprint and used the InputAction “Fire” event in my character’s blueprint like so:

And that worked really well. However, now that I would like to add a variety of guns. The character’s blueprint now starts the game empty handed and the gun is spawned in the player’s hand via the Game Mode like so:

(I moved the firing logic to the weapon’s blueprint, and added a cast to character so everything would be trigerred properly.)

So now that the weapon is in the character’s hand as a child actor, I was expecting the input to fire the weapon. But the “InputAction Fire” in the gun’s blueprint never gets triggered.

Can someone tell me what I’m missing or at least point me in the right direction to get that gun to fire some bullets again?

This is what I have in my weapon’s blueprint. And it’s attached to the character’s mesh on begin play via the gamemode.

I’m starting to think I might be able to check the weapon type and deal with the firing logic based on the weapon type from the character blueprint. But then again, I have no idea what I’m doing.

If that can help anyone, I fixed this by creating a custom event in my weapon blueprint and simply fire the event from the character blueprint like this:


Now I just need to figure out how I’m going to deal with different weapons.

Hi, you need to enable input in your weapon actor otherwise it won’t trigger any input events. But it is generally better to handle all input either in the player controller or the controlled pawn. Then you have it all in one place.

So having the input inside the player pawn and calling the event on the weapon from that is fine. But I wouldn’t cast it to a specific weapon. Either use an interface or make a “MyBaseWeaponClass” where you have all the logic and then cast to that. Cause if you cast to something, then it will be referenced and everything that an asset references (and everything that those things reference and so on…) will be loaded into memory as soon as that asset is loaded into memory. Since the player pawn is most likely to always exist in the world and therefore always being loaded into memory, you should keep hard referencing meshes and textures from that at a minimum (you can right click on an asset and view the SizeMap and ReferenceViewer).

Also I wouldn’t compute the aim transform inside the weapon, but make that an input into the Fire event. Will make it much easier if you plan on adding bots later on.

And I would suggest that you also watch this here Blueprint Kickstart - Unreal Engine

Thank you for taking the time to answer. I have a better understanding of how things “should” work now. Probably a good idea to watch the course too. Anyway, thank you.