- Home /
audio is not working?
var bulletPrefab : Transform; var ShootClip : AudioClip; var shootForce : float = 1000;
function Update () { if(Input.GetMouseButtonDown(0)) { //fire bullet
fire();
audio.clip = ShootClip;
audio.Play();
//audio clip
}
}
function fire() { var instanceBullet = Instantiate(bulletPrefab,transform.position,Quaternion.identity); instanceBullet.rigidbody.AddForce(transform.forward*shootForce);
//audio.PlayOneShot(ShootClip);
} bullets are firing well but no sound produce Pleace Help
Is this a 3d sound or a 2d sound? Where is your Audio Listener in relation to the AudioSource?
Also please reformat your code to be read easier.
check that ShootClip is well assigned in the inspector
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How do I fix audio loop delay 2 Answers
Footstep Script Not Working 2 Answers
Slender like game 3 Answers
What does the numSamples parameter in GetOutputData actually mean? 1 Answer