- Home /
 
 
               Question by 
               Momaboba213 · May 31, 2020 at 01:50 PM · 
                audioaudiosourceaudioclipaudio.playoneshot  
              
 
              How to switch Audiosource without stacking by an input?
So I am trying to make a script where if the player presses the mouse button then Clip A will play but if not the Clip B will play.
To get an image of this is: My player is hiding under the bed, and if he is not closing his eyes then clip b will play but if he closes then clip A will play and will revert to Clip B if he releases the button
         if (_EyesOpened == true && Time.time > _WaitDam && _MonsterIn == true)
         {
             _WaitDam = Time.time + _Damage;
             _Sanity--;
             _SSplayer.PlayOneShot(_ScarySounds[0], 0.7f);
         }
 
        if (Input.GetMouseButton(0))
         {
             _EyesOpened = false;
             _BlinkPlease.Blink(true);
             _SSplayer.PlayOneShot(_ScarySounds[1], 0.7f);
             if (_Sanity < 10 && Time.time > _WaitDam)
             {
                 _WaitDam = Time.time + _Heal;
                 _Sanity++;
             }
         }
 
               Through that code the audio becomes stuttery like they are continuously being played and stacked
               Comment
              
 
               
              Your answer