How do I make a gun?

Okay, so I am making a first person shooter in Unity, and I am working on the gun. I have the gun set, I have a muzzle flash, and I have the sound effects and the reloading and stuff like that. Now all I need to do is make it project a particle effect directly in the center of the screen, where the crosshair is. I made a function called particle, and when I shoot, I call that function. I have no clue what to put in there though. I have been looking forever, but I am completely clueless. I have even tried the machinegun.js in the first person shooter tutorial, but still, nothing. Any help would be greatly appreciated.

If you're wanting to simulate a tracer round's light streak I would use a LineRenderer from the tip of the gun to the point where you will hit. Create it then destroy it a frame later.


If you want impact/ricochet sparks, create a prefab with a particle emitter, make it one shot and autodestruct. Then instantiate it at the impact point.


You can get the point where you will hit by using `Physics.Raycast` with `Camera.ScreenPointToRay`