Hey guys, I’m just wondering is it possible to randomize 2 or more clips from an AudioSource List by name? Something like this:
OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.CompareTag("Coin")
{
for (int i = 0; i < soundCtrlList.Count; i++)
{
if ((soundCtrlList_.clip.name == "Sound1") || (soundCtrlList*.clip.name == "Sound2"))*_
{
// Here I’m trying to see if I can play a random clip by name either Sound1 or Sound2
}
}
}
}
Of course, both SFX will be found by name since they are in the List. However, I’m just wondering if there is a way to randomly play one of 2 or more SFX by name.
Thanks