Question by
CreeperBoyNick · Oct 27, 2016 at 03:49 PM ·
error message
i get error cs1519 please help it says this assets/begin/my scripts/shoot.cs(9,15): error cs1519 : unexpected symbol ' private ' in class, struct, or interface member decleration
using UnityEngine;
using System.Collections;
namespace Chapter1
{
public class Shoot : MonoBehaviour
{
private float fireRate = 0.3f
private float nextFire;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
CheckForInput();
}
void CheckForInput()
{
if (Input.GetKey(KeyCode.Mouse0) && Time.time > nextFire)
{
nextFire = Time.time + fireRate;
Debug.Log("Key Pressed");
}
}
}
}
Comment
Answer by CreeperBoyNick · Oct 27, 2016 at 03:51 PM
this is where the problem is
private float fireRate = 0.3f private float nextFire;
Answer by Landern · Oct 27, 2016 at 05:07 PM
You're missing a semi-colon:
using UnityEngine;
using System.Collections;
namespace Chapter1
{
public class Shoot : MonoBehaviour
{
private float fireRate = 0.3f; // missing semi-colon.
private float nextFire;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
CheckForInput();
}
void CheckForInput()
{
if (Input.GetKey(KeyCode.Mouse0) && Time.time > nextFire)
{
nextFire = Time.time + fireRate;
Debug.Log("Key Pressed");
}
}
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612095538im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Error when setting Rotation 2 Answers
UCE0001: ';' expected. Insert a semicolon at the end. 1 Answer
0xc000007b error on 64 bit machine? 1 Answer