top of page

UE5: How to add a new Weapon in 10 minutes

A quick tutorial on how to add/set up a new weapon to your game, including animations. Using available assets from the Marketplace (e.g. Military Weapon Silver).


I. Add the new Weapon to Skeleton

  1. Select/Upload/Migrate/Add your selected weapon to your game (Content folder)

  2. Open the weapon folder to see all the related assets (Mesh, Material, Texture, Anims)

  3. Open Character Skeletal Mesh, go to Skeleton (top right section tab)

  4. On the left side, select the Skeleton Tree tab

  5. In the list, Find your right-hand bone (hand_r), click, and Add socket

  6. Rename with PistolSocket

  7. Right-click on it, add Preview asset, scroll down, search for Pistol_A

  8. Adjust the pistol position using W.E.R. commands (rotation, size, angle) + camera speed

  9. Under Preview Animation (sub nav bar at the top), Pause animation/Idle

  10. Go to BP_Character BB, left side, add a new Skeletal Mesh, rename (e.g. PistolMesh), select then...

  11. Right side, under Mesh, clear Skeletal Mesh and replace with Pistol_A (Weapon file name)

  12. The weapon will appear on the screen

  13. Right side, under Sockets, Parent Sockets, search for PistolSocket

  14. It should now be snapped to the Hand

  15. Click play to test

  16. If needed, debug by watching this great video: https://youtu.be/qOam3QjGE8g?t=1800


II. Setting up aiming states

  1. Go to Content Drawer, Anims folder

  2. Open TSSAnim_BP, Go to Idle/Run tab

  3. Select New state Machine (nav breadcrumbs)

  4. Drag Idle/Run to create another state, named IdleToAim

  5. Drag from it and create another state, named Aim

  6. Drag from Aim, create another state, name AimToIdle, and drag it back to Idle/Run

  7. Compile (see errors = normal) - Time to set up the transitions (arrows between states) - see step 11

  8. Before that, let's set up States.

  9. Double click on IdleToAim, select IdleToAim animation (bottom right), drag to Result, compile

  10. Same for all the others, select the related animation and hook that with Result, compile

  11. To setup animations, double click on the Arrows between states (e.g. Idle/Run to IdleToAim), drag left side, and promote to variable

  12. Name variable IsAiming?

  13. Compile and Save

  14. For IdleToAim to Aim, click on the arrows

  15. Right-click, select Time Remaining (ratio) IdleToAIm

  16. Drag the return value and select "Less" (e.g. Less < 0.7)

  17. Hook that to Can Enter Transition

  18. For Aim to AimToIdle, click on the arrows, drag the IsAiming Variable, select Not Boolean

  19. Link to Result (if not aiming, then we enter the AimToIdle state

  20. AimToIdle to Idle/Run, add Time Remaining(ratio) AimToIdle, drag return value, and select Less, <0.7, link to can enter transition.

  21. Compile and Save


III. Using/Binding right-click as Aiming

  1. Open BP_Character

  2. Create a new variable, "Aiming?"

  3. Compile/Save

  4. Go to TSSAnim_BP, Event Graph

  5. Find Event Try Get Pawn Owner, drag return value, cast to [BP_Character] (or whatever your file name is) (and hook to Set Speed)

  6. Drag As BP_Character -> Get Aiming?

  7. Drag IsAiming variable, Set IsAiming, hook to Exec pin

  8. Go to BP_Character, Event Graph

  9. In the Graph, right-click, Get Right Mouse Button (Legacy)

  10. Drag Aiming variable, Set Aiming? Now hook Pressed to it and -> Tick.

  11. Drag Aiming variable, Set Aiming? Now hook Released to it and -> Untick

  12. Test

  13. To slow down character when Aiming, do as follow,

  14. Go to BP_Character, Event Graph

  15. On the left side, select Character Movement and drag to the graph,

  16. Drag off and type Set Max walk Speed, hook to exec pin

  17. Set Max Walk Speed to 200

  18. Copy this for the released aiming section, and set that max speed back to 600

IV. Add additional Animations (e.g. IdleFire or HipFire)

  1. Find the weapon (e.g. Pistol animations) in the Weapons/Animations folder

  2. Find the Fire_Pistal_W and double-click to see the animation as well as the Muzzle Flash (Particle effect) and sound

  3. To add, right-click, Add Notify (...)

  4. Select AimFire + IdleFire, right-click, and create animation montages

  5. Go to BP_Character

  6. On the Event Graph, add Left Mouse Button.

  7. Get Aiming? variable, drag and get branch, hook exec pin (Pressed)

  8. From True, play anim montage

  9. In skeletal mesh component, drag and hook to the FirstPersonMesh (from Component, top left side)

  10. Montage to Play will be AimFire_Montage

  11. Compile/Save

  12. Duplicate that Play Montage, hook to False, and hook to FirstPersonMesh as well

  13. Montage to Play, select IdleFire montage

  14. Open TSSAnim_BP, Go to New State Machine, and back to Anim Graph.

  15. Drag New State machine, select Slot Default Slot, and link this to Output Pose. Compile/Save

16. To play the firing animation, incl muzzle flash + sound, in the BP_Character, Event Graph, Drag the PistolMesh, Drag and select Play Animation, hook to both exec pins.

17. Select Fire_Pistol_W as anim to play.


This is a simplified tutorial. For the full tutorial & video, visit this excellent channel - https://youtu.be/qOam3QjGE8g

bottom of page