Let’s build a animation for the pistol. This will occur under the fireWeapon function and this class should be built to encompass all classes. To start, let’s work on the pistol by adding in a muzzle flash, bullet case ejection, and smoke from filebase.
In each of these animations, I made sure the emission was set to burst.
Then, create the ability to hunt down and find your muzzle flash, bullet case, and smoke animations in your fireweapon script.
I repositioned the fire script back on to the parent barret pos gameobject.
I then on start connect with those particle systems.
In custom controls, I remove the previous animator and just have the script run a new function called FireThisWeapon.
Now I had to set the texture from an HDRP to a mobile particle — for some odd reason, it still retains in HDRP and is still applicable to fading in and out.
Looks real good from the side, but not so much from the front. I added muzzleflash02 and have that setup in the firing system. Now your weapon fire is complete.