Hi, does any one know where I'v gone wrong here. Iv got is so when I press W, A or S my audio plays and it doesn't matter if I press two at the same time it still plays the audio.
The only problem I have now is the audio Loops too fast is there any way of stopping this?
Check out the FPS tutorial for a walk through... If anyone else can go through your script and actually see what to do, then I'd wait for that. But until then, see what you can see on your own...
Check the FPSPlayer script, they use an array of walking sounds to vary it up.
function PlayStepSounds () {
var controller : CharacterController = GetComponent(CharacterController);
while (true) {
if (controller.isGrounded && controller.velocity.magnitude > 0.3) {
audio.clip = walkSounds[Random.Range(0, walkSounds.length)];
audio.Play();
yield WaitForSeconds(audioStepLength);
} else {
yield;
}
}
}
And it is called during the awake function... See if that helps.
i would think if you put in a scheduled timer, like the
yield WaitForSeconds(audioStepLength);
that would be what you are looking for and just mess around with the time till you got it where you want it.
I'm new to Unity and haven't got into coding anything yet, but i'm sure you can set a timer to wait to begin the loop again.