Hey i have a gun script that works great but i need to transfer it from pc to android. Like instead of me clicking the scene i want it so when you press a gui texture, it fires, like on the pc version. But, i also need a gunshot sound to play when i touch the gui texture, as i shoot the gun.
Here is the gun script!
var Bullet : Transform;
var Spawn : Transform;
function Update ()
{
if(Input.GetButtonDown("Fire1"))
{
Shot();
}
}
function Shot()
{
var pel = Instantiate(Bullet, Spawn.position, Spawn.rotation);
pel.rigidbody.AddForce(transform.forward * 10000);
}
↧