title: Stop audio when is playing another one in Unity3D
body: <p>How can I stop one audio when is playing another one?</p>
  
  <pre><code>public AudioSource audioSource;
  public AudioClip audioClip;
  private string[,] levelWords;
  //public static string glupiaZmienna;
  public Text txt;
  
  public void OnPointerClick(PointerEventData eventData)
  {
      Debug.Log(gameObject.name);
      WordsLoader w = new WordsLoader();
      levelWords = w.wLevelWords;
      SetCategoryButton scb = new SetCategoryButton();
      int a = scb.Kategoria;
      zupa();
  
      AudioSource audio = gameObject.AddComponent&lt;AudioSource&gt;();
      audio.Stop();
      audio.clip = (AudioClip)Resources.Load(a+ "/" + WordsLoader.language + "/Sounds/" + gameObject.name);
  
      audio.Play();
  
  
     // txt = gameObject.GetComponent&lt;Text&gt;();
  }
  
  public void zupa()
  { WordsLoader w = new WordsLoader();
      SetCategoryButton scb = new SetCategoryButton();
      int a = scb.Kategoria;
      print(w.wHowManyWords);
  
      for (int i = 0; i &lt; w.wHowManyWords; i++)
      {
          print("jestem tu");
          if (levelWords[i, 0] == gameObject.name)
          {
              txt = GameObject.Find("Text").GetComponent&lt;Text&gt;(); ;
              txt.text = levelWords[i, 2];
          }
  
      }
  }
  </code></pre>
  
  <p>This code is in a script which start playing a sound after click a button. I would like stop earlier started audio.</p>