- Home /
This question was
closed Mar 08, 2015 at 11:46 PM by
KnightRiderGuy for the following reason:
I was able to do it in Java but not C#
Question by
KnightRiderGuy · Feb 27, 2015 at 09:02 PM ·
c#audiosourceaudiocliparraylistaudio source
How to get C# Array to Load into Audio Source
I have this audio array that is not actually loading the audio clips into the actual sound source slot. I need this in order for the Music Visualizer to read the sound but it does not load the clips into the Audio Source slot. Here is a snippet from the top of my script with a few buttons with the audio from the array assigned.
using UnityEngine;
using System.Collections;
public class VBtestAudioVisualizer : MonoBehaviour
{
//Audio Clips Array
public AudioClip[] VoiceClipList;
void Start() {
AudioSource[] VoiceClipList = GetComponents<AudioSource> ();
}
//Audio Play Buttons
public void GoVoiceClip01(){
//audio.PlayOneShot(VoiceClip01);
audio.PlayOneShot(VoiceClipList[0]);
}
public void GoVoiceClip02(){
//audio.PlayOneShot(VoiceClip02);
audio.PlayOneShot(VoiceClipList[1]);
}
Comment