We have already created the projectile for the gun, and we also created the sound source for it, but we are yet to make this act like a ball gun; this is when scripting comes in handy.
The first thing we need to do is to create a prefab for the projectile we created. This is to be able to clone the projectile through the script and fire it at the poor moles. To do that, simply create a folder in the Assets folder, and name it
Prefabs. Drag-and-drop the Ball object from the Hierarchy panel to the folder you just created. Now we have a prefab that we can call upon through code and can create as many balls as we want.
The ball we have attached to the camera is meaningless, because we will be creating the projectiles through code. ...