Hello anybody,
I am trying to play a certain sound on the first collision, and then a different sound on subsequent ones. But, even the basic code below won’t make a sound. Any hints on getting this code working?
Thank you! Any response will be greatly appreciated. The code below runs without errors, but won’t sound.
function OnTriggerEnter() {
var x9:AudioClip;
var x10:AudioClip;
// audio.Play(); // this one works for one sound
// call another function to get the sounds and play them
Playsounds(x9);
// @script RequireComponent(AudioSource) does not work
}
//@script RequireComponent(AudioSource) doesn’t work here either
function Playsounds(myclip:AudioClip) {
audio.PlayOneShot(myclip);
print(“Hello2”); //it’s printing, so I know it has gotten here
//@script.RequireComponent(AudioSource) fugeddaboutit
}