O'Reilly logo

Mastering Game Development with Unreal Engine 4 - Second Edition by Matt Edmonds

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Converting the existing gun

Opening up MasteringWeapon.h and .cpp, let's add some variables as UPROPERTY items again, and our goal now is to replicate what is currently done in MasteringCharacter in our weapon and then remove those items from the character class. As a reminder, the things our weapon needs to contain are as follows:

  • Gun Offset (FVector)
  • Fire Sound (USoundBase)
  • Fire Animation (UAnimMontage)
  • Projectile Class (TSubclassOf<class AMasteringProjectile>)
  • Weapon Mesh (USkeletalMeshComponent)
  • Muzzle Location (USceneComponent)

At this point, as we have a bit of code work to do and don't want to be hot-reloading a lot, I recommend shutting down the editor until we're ready to add a new instance of MasteringWeapon to the game. So, let's ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required