I refactored the Sound FX and Sound FX Handler into a generic Pooled Object and Object Pool Handler. Attaching the Pooled Object component to any Game Object allows it to be reused via the Object Pool Handler that creates it.
An Object Pool Handler stores its recyclable objects inside a Game Object specified in the Inspector. Objects are created until the buffer reaches its capacity and then begins recycling the objects.
These two methods create and recycle the Pooled Objects. I had a bug in the Visual FX because I did not update the rotation while recycling the object.
Here you can see the Assault Rifle prefab variant. The two child objects Gunshot and Muzzle both have Object Pool Handler components. Gunshot generates Pooled Objects that are Sound FX while Muzzle generates Pooled Objects that are Visual FX.
I’m not a huge fan of the command being Object Pool Handler > Run. It isn’t very descriptive. One option would be to wrap the generic object in a more descriptive class:
This would show as Visual FX Handler > Play FX in the editor. It’s more readable but feels excessive. I may change it up down the line.