i’ve seen some scripts of 2D Game play Tutorial Project file . and used it to my game character .and it seems very simple but i can’t imagine what’s wrong with it . after hit play the game and when my character walk,footstep sound is normal but when player run,the footstep sound can’t stay with foot step speed and slower . any body help me for this scripts . I used this script .
var audioStepLength = 0.3; var walkSounds:AudioClip[]; function Start () { 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; } } }
just like that . thanks