Always what should be the simple things.
Trying to get my FPS player that when he walks over a "Meadow Muffin" that he says "Dag Gumit!"
I'm using this in my FPS player script:
function OnCollisionEnter (other : Collision) {
if (other.gameObject.name == "MeadowMuffin") {
audio.clip = meadowMuffinCurse;
audio.Play();
}
}
I have a varible set up as:
var meadowMuffinCurse : AudioClip;
And I've assigned the apropriate sound in the inspector
My "Meadow Muffin" even has a box collider which is set to "Trigger" but the sound does not play.
OK great, it's working, but it does not play the whole clip. it's such a small object that if my player stands exactly on it it will play the whole clip, but if I pass therough it it just play a very small fraction of the audio clip. How do I fix that?
– anon48034950Maybe you have to increase the Maxdistance value on your audio source. Also check your rolloff curve. Make sure the object where the audioSource is attached to is not deleted. Where is that script attached to? If this is executed on the player, make sure you didn't start another sound on the same Audiosource. That would stop the current one.
– Bunny83That could be it, I have it on my FPS player script but I added a "audio.PlayOneShot(meadowMuffinCurse); yield WaitForSeconds(meadowMuffinCurse.length);" To it and that seems to have fixed it for the most part. There is the odd occasion where the sound cuts short still?
– anon48034950