So I have the background music playing and hooray for that. However I can’t get the one-shot sound effects to work as they are supposed to.
public AudioClip caughtGood;
public AudioClip caughtGold;
public AudioClip caughtBad;
public AudioClip combo_increased;
...
void Start ()
{
... // previous code
if((caughtBad != null || caughtGold != null || caughtGood != null || combo_increased != null) &&
audio == null) {
AudioSource source = gameObject.AddComponent<AudioSource>();
source.playOnAwake = false;
}
}
void PlaySound(AudioClip source) {
if(audio && source) {
audio.PlayOneShot(source);
}
}
Then I am calling for example:
private void incrementCombo () {
if (comboCount < 2) {
comboCount++;
} else {
...
PlaySound(combo_increased);
...
}
}
Can someone please help me out. It is really weird why it won;t work.
I f you don't have any luck, suggest it to Unity Support on the forums. Or maybe just ask them, they should know, they wrote the bloody thing :P
– meat5000