Audio scripting

Updated on May 24, 2016 in [A] Audio
Share on Facebook0Tweet about this on Twitter0Share on Google+0Share on Reddit0
3 on May 23, 2016


public void PlayDefaultAudio(bool On)

{

if (On == true)

{

AudioSource.PlayOneShot(DefaultAudio);

TapText.SetActive(false);
}

else

{

DefaultAudio...... // insolved

}


is there a way to disable the audio ? what i want is when the player die the default audio stops and the gameover audio plays and im accessing this Function through other scripts so what i do is i cchange the bool on of !on any help :) ?

  • Liked by
Reply
0 on May 23, 2016

So, playoneshot just does what it does. It’s good to use for things like gunshots and other short sounds. For longer sounds I recommend you to give a gameobject an audiosource component. Then you can turn on and off that thing.

  • Liked by
Reply
Cancel
1 on May 24, 2016

ah got it thanks man 
so i assume that there is no commande to cancel playoneshot ?

Guru
on May 24, 2016

Not that I know of.

Show more replies
  • Liked by
Reply
Cancel