Gun shoot problem?
I'm currently participating in a Unity tutorial, and I ran into something weird. The term "&&," which he uses, is an "invalid expression" in my game. I don't understand, could it be a simple mistake I made earlier in the script? This is a piece of it:
void Update() { if (Input.GetButtonDown("Fire1")) && Time.time > nextFire) { nextFire = Time.time + fireRate;
StartCoroutine(ShotEffect());
Vector3 rayOrigin = fpsCam.ViewportToWorldPoint(new
Vector3(0.5f, 0.5f, 0)); }
Also, this is the tutorial: Let's Try: Shooting with Raycasts (Video)
Comment
Answer by UnityCoach · Dec 13, 2016 at 11:54 PM
There's an extra closing parentheses.
if (Input.GetButtonDown("Fire1")) && Time.time > nextFire)
>>
if (Input.GetButtonDown("Fire1") && Time.time > nextFire)
Your answer
Follow this Question
Related Questions
Virtual hands in FPS MMO game 1 Answer
Vertical gun movement exaggerated 0 Answers
How do I make a script for camera recoil recovery? 0 Answers