HI I have this code
using UnityEngine;
using System.Collections;
public class Gun : MonoBehaviour {
public GameObject BulletPreFab;
public AudioClip laser;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyUp (KeyCode.Mouse0)) //If mouse 0(left click) is released
{
Instantiate(BulletPreFab, transform.position, Quaternion.identity);
audio.PlayOneShot(laser);
//Make an instance of a bullet when mouse 0 is released and keeps the bullet instance position
//related to your spaceship.
}
}
}
For some reason when I press the trigger (mouse 0) the audio clip is not playing?
Any solutions?