I am having an issue with my incomplete shooting script. I tried testing it out, but I can’t due to the error CS1002. If anyone has the solution to this issue, it would gradually help me out. You can read my code here:
The errors seem to be in line 27 and 28.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using StarterAssets;
public class NewBehaviourScript : MonoBehaviour
{
private StarterAssetsInputs _input;
// Start is called before the first frame update
void Start()
{
_input = transform.root.GetComponent<StarterAssetsInput>();
}
// Update is called once per frame
void Update()
{
if (_input.shoot)
{
Shoot();
_input.shoot = false;
}
}
void Shoot()
{
Debug.log("shoot!")
}
}
I tried to play the game and test it out to see if it was functioning, but I couldn’t test it due to the error.
>Solution :
There’s a semicolon missing here:
void Shoot()
{
Debug.log("shoot!") ;
}
You need to end a C# statement with a semicolon, even if it’s followed by a closing bracket.