Hi, so this is the code, want to know if I can do this more efficiently than a load of if statements which is what it currently is, for the part in the if statement I’m pretty sure that would be fine to do as a for loop using the CharacterNames from the string array I’ve made in the character.name part, but it does not work for the audioClip array, may just be a limitation or is there another way to do this, I get the error:
error CS1503: Argument 1: cannot convert from ‘string’ to 'UnityEngine.AudioClip. (but this works if I keep it as Billy[0],Billy[1].
Thanks for any advice.
static public AudioClip[] Billy;
public string[] CharacterNames;
string[] CharacterNames = { "Billy", "Blazer" };
//play randomized jump sfx
if (Character.name == "Billy")
{
Completed.SoundManager.instance.RandomizeSfx(({CharacterNames[0]}[0], Billy[1]);
}