Quantcast
Viewing all articles
Browse latest Browse all 592

Firing Sound

I have a firing script, as shown below. How do I add a sound that plays whenever the gun fires? It is a machinegun, so it needs to loop when you hold down the button. var projectile : Rigidbody; public var speed = 10; public var destroyTime = 1; function Update () { if ( Input.GetButton ("Fire1")) { clone = Instantiate(projectile, transform.position, transform.rotation); clone.velocity = transform.TransformDirection( Vector3 (0, 0, speed)); Destroy (clone.gameObject, destroyTime); }}

Viewing all articles
Browse latest Browse all 592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>