Because it’s in a contained space, you could probably get away with using a flat plane with a texture on it, that tracks along its axis to face the camera (but stays aligned with the gun on its other two axes). A slightly bowed shape to the cross-section of the plane could improve the effect a little for those times when the gun is pointing directly towards or away from the camera. This effect looks good as long as nothing intersects or collides with the beam (and odds are that’s the technique the screenshot you provided uses), so I wouldn’t recommend using it outside of the tube of the gun, though.