title: Projectile null value
body: <p>I'm trying to make a shooter game but when I shoot while there are still bullets spawned I get these error codes:</p>
  <pre><code>ArgumentNullException: Value cannot be null.
  Parameter name: source
  UnityEngine.AudioSource.Play () (at &lt;ec7b0cef068d42fea98bc6f00449b0e2&gt;:0)
  RayCastShootComplete+&lt;ShotEffect&gt;d__12.MoveNext () (at Assets/Let's Try 
  Shooter/Scripts/CompletedScripts/RayCastShootComplete.cs:87)
  UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, 
  System.IntPtr returnValueAddress) (at &lt;7d87237cea3743d093e22c5b98f74fba&gt;:0)
  UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
  RayCastShootComplete:Update() (at Assets/Let's Try 
  Shooter/Scripts/CompletedScripts/RayCastShootComplete.cs:41)
  
  NullReferenceException: Object reference not set to an instance of an object
  RayCastShootComplete.Update () (at Assets/Let's Try 
  Shooter/Scripts/CompletedScripts/RayCastShootComplete.cs:44)
  </code></pre>
  <p>Here is the code it is referencing:</p>
  <p>using UnityEngine;
  using System.Collections;</p>
  <p>public class RayCastShootComplete : MonoBehaviour {</p>
  <pre><code>public int gunDamage = 1;                                           // Set the number of hitpoints that this gun will take away from shot objects with a health script
  public float fireRate = 0.25f;                                      // Number in seconds which controls how often the player can fire
  public float weaponRange = 50f;                                     // Distance in Unity units over which the player can fire
  public float hitForce = 100f;                                       // Amount of force which will be added to objects with a rigidbody shot by the player
  public Transform gunEnd;                                            // Holds a reference to the gun end object, marking the muzzle location of the gun
  
  private Camera fpsCam;                                              // Holds a reference to the first person camera
  private WaitForSeconds shotDuration = new WaitForSeconds(0.07f);    // WaitForSeconds object used by our ShotEffect coroutine, determines time laser line will remain visible
  private AudioSource gunAudio;                                       // Reference to the audio source which will play our shooting sound effect
  private LineRenderer laserLine;                                     // Reference to the LineRenderer component which will display our laserline
  private float nextFire;                                             // Float to store the time the player will be allowed to fire again, after firing
  
  
  void Start () 
  {
      // Get and store a reference to our LineRenderer component
      laserLine = GetComponent&lt;LineRenderer&gt;();
  
      // Get and store a reference to our AudioSource component
      gunAudio = GetComponent&lt;AudioSource&gt;();
  
      // Get and store a reference to our Camera by searching this GameObject and its parents
      fpsCam = GetComponentInParent&lt;Camera&gt;();
  }
  
  
  void Update () 
  {
      // Check if the player has pressed the fire button and if enough time has elapsed since they last fired
      if (Input.GetButtonDown(&quot;Fire1&quot;) &amp;&amp; Time.time &gt; nextFire) 
      {
          // Update the time when our player can fire next
          nextFire = Time.time + fireRate;
  
          // Start our ShotEffect coroutine to turn our laser line on and off
          StartCoroutine (ShotEffect());
  
          // Create a vector at the center of our camera's viewport
          Vector3 rayOrigin = fpsCam.ViewportToWorldPoint (new Vector3(0.5f, 0.5f, 0.0f));
  
          // Declare a raycast hit to store information about what our raycast has hit
          RaycastHit hit;
  
          // Set the start position for our visual effect for our laser to the position of gunEnd
          laserLine.SetPosition (0, gunEnd.position);
  
          // Check if our raycast has hit anything
          if (Physics.Raycast (rayOrigin, fpsCam.transform.forward, out hit, weaponRange))
          {
              // Set the end position for our laser line 
              laserLine.SetPosition (1, hit.point);
  
              // Get a reference to a health script attached to the collider we hit
              ShootableBox health = hit.collider.GetComponent&lt;ShootableBox&gt;();
  
              // If there was a health script attached
              if (health != null)
              {
                  // Call the damage function of that script, passing in our gunDamage variable
                  health.Damage (gunDamage);
              }
  
              // Check if the object we hit has a rigidbody attached
              if (hit.rigidbody != null)
              {
                  // Add force to the rigidbody we hit, in the direction from which it was hit
                  hit.rigidbody.AddForce (-hit.normal * hitForce);
              }
          }
          else
          {
              // If we did not hit anything, set the end of the line to a position directly in front of the camera at the distance of weaponRange
              laserLine.SetPosition (1, rayOrigin + (fpsCam.transform.forward * weaponRange));
          }
      }
  }
  
  
  private IEnumerator ShotEffect()
  {
      // Play the shooting sound effect
      gunAudio.Play ();
  
      // Turn on our line renderer
      laserLine.enabled = true;
  
      //Wait for .07 seconds
      yield return shotDuration;
  
      // Deactivate our line renderer after waiting
      laserLine.enabled = false;
  }
  </code></pre>
  <p>}</p>
  <p>Does anyone know what I should do?</p>
  <p>For clarification it is a post-apocalyptic game where the protagonist is trying to find a new home.</p>