one thing id like to know is accessing audio clips through scripting. now, i dont mean where i drag over an audio clip to an object and then using something like this:
or can someone help in accessing multiple sound from one object, using something like the first code snippet. i cant seem to find these things at all. its just for one sound, which has been useful, but need something for many more sounds for different things
also i do know about the use of sounds within the animation pane. which is cool.
but just need something where i can access the folder where things are stored to play
ok, ive re-worked it to have drag and drop. now im running into a error when using this type of code. it says:
MissingComponentException: There is no ‘AudioSource’ attached to the “objPlayer” game object, but a script is trying to access it.
You probably need to add a AudioSource to the game object “objPlayer”. Or your script needs to check if the component is attached before using it.
objPlayer.Update () (at Assets/Scripts/objPlayer.cs:63)
public AudioClip jumpSound;
if(!audio.isPlaying){
audio.clip = jumpSound;
audio.Play();
}
but what i have done is a drag and drop of the audio onto that audio.clip that i coded in. so i just then drag in what sound i need in unity for the jump control. but im running up dry. i figured that this way would be best to move ahead since i can then access and set sounds to what i need