[System.Serializable]
public class Boundary
{
public float xMin, xMax, zMin, zMax;
}
public class PlayerController : MonoBehaviour
{
private Rigidbody rb;
private AudioSource AudioSource;
void Start ()
{rb = GetComponent();}public float speed;
public float tilt;
public Boundary boundary;
public GameObject shot;
public Transform shotSpawn;
public float fireRate;
private float nextFire;
AudioSource = GetComponent ();
void Update ()
{
if (Input.GetButton (“Fire1”) && Time.time > nextFire) {
nextFire = Time.time + fireRate;
Instantiate (shot, shotSpawn.position, shotSpawn.rotation);
AudioSource.Play ();
}
}
Hello people, I just started to use unity and i m a newbie with coding as well. I was doing that unity beginner tutorials and some of them has updates because of changes on unity. Anyway my problem starts here I do the changes that mentioned in updated version to make it work but still i get errors. I want to use a audio for my firing effect. I’m getting error from the red one. And my game doesn’t start for testing so i believe that happens because of script? Or its something else?
Thanks