// Ищет и возвращает найденные звуки, по указаному имени public static BingogoAudio[] getSoundsByName(params string[] name) { var soundsGO = GameObject.FindGameObjectsWithTag("BingogoSound"); if (soundsGO.Length == 0) { return(null); } int count = 0; for (int i = 0; i < soundsGO.Length; i++) { for (int j = 0; j < name.Length; j++) { if (soundsGO[i].name == name[j]) { soundsGO[count++] = soundsGO[i]; } } } BingogoAudio[] res = new BingogoAudio[count]; for (int i = 0; i < count; i++) { res[i] = soundsGO[i].GetComponent <BingogoAudio>(); //Debug.Log("█ find winSound: " + res[i].name); if (res[i] == null) { Errors.showTest("При поиске проигрывающихся аудио, возникла ошибка!"); } } //Debug.Log("█ count: " + count); return(res); }
// ... static void onAudioPlayFinish(BingogoAudio audio) { }