I want to play a audioclip when the character is touching the ground and I want to pause the audioclip when the character is in the air. Okay, so I have this script attached to a gameobject with an audiosource:
var controller : CharacterController;
function Update ()
{
if (controller.isGrounded)
{
audio.Play();
}
else
{
audio.Pause();
}
}
But I can’t get it to work. All this does is start a static noise.
I would be grateful if somebody would try help me.
Thanks in advance.