Random Errors? Help Needed

Unity is giving me 3 random compiler errors and I don’t quite understand why. I just started making code with Unity so any help will be appreciated.
These are the errors:
.
(27,42): error CS1513: } expected,
.
(31,5): error CS8803: Top-level statements must precede namespace and type declarations.,
.
(60,1): error CS1022: Type or namespace definition, or end-of-file expected
.
Here is my code:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PointAndShootV2 : MonoBehaviour
{
    public GameObject spawnPoint;
    public GameObject projectTilePrefab;
    public float projectTileSpeed = 1;
    DateTime lastSpawnTime = DateTime.Now;
    public int millisecondsBetweenProjectiles = 1;
    public bool AutoFire = false;
    public float secondsBeforeProjectileDies = 10;
    public float secondsBeforeShotEffectsDestroy = 1;
    public float Shots = 1;
    public float reloadTime = 1000;
    private Camera camera;
    [SerializeField] private float _rotationSpeed = 1;
    public GameObject shotEffectsPrefab;
    Rigidbody2D rb;


    void Start()
    {
        _cam = Camera.main;
//        rb = GetComponent<Rigidbody2D>();
        public float ShotsLeft = Shots;
    }

//    void Update()
    {
        var mousePosition = camera.ScreenToWorldPoint(Input.mousePosition);
        mousePosition.z = 0;

        var dir = mousePosition - transform.position;
        transform.up = Vector3.MoveTowards(transform.up, dir, _rotationSpeed * Time.deltaTime);


        if ((AutoFire || Input.GetMouseButtonDown(0)) && (DateTime.Now-lastSpawnTime).TotalMilliseconds > millisecondsBetweenProjectiles && ShotsLeft >= 1)
        {

            Instantiate(projectTilePrefab, spawnPoint.transform.position, Quaternion.identity);

            ShotsLeft = ShotsLeft - 1;

            if (shotEffectsPrefab != null)
            {
                GameObject image = Instantiate(shotEffectsPrefab, spawnPoint.transform);
                Destroy(image, secondsBeforeShotEffectsDestroy);
            }
        }

        if(ShotsLeft < Shots && (DateTime.Now-lastSpawnTime).TotalMilliseconds > reloadTime)
        {
            ShotsLeft = ShotsLeft + 1;
        }

    }
//}

The lines with errors are commented out

Hey @Pixel8tedPotato . Could you comment out the lines of code the errors are mentioning? (I cant find them without the line numbers.)
It looks like to me that you might have accidentally shifted a } and now VS is confused. (It’s happened to me countless times).
Thanks! :slight_smile:

Well,
Your Start method is a little strange :
_cam = Camera.main;
→ You didn’t declared the _cam variable. You probably mean to change ‘camera’ property value.

public float ShotsLeft = Shots;
→ You are declaring a public variable into the start method, that’s not allowed.

Here is the start method correction :

    public float ShotsLeft;

    void Start()
    {
        camera = Camera.main;
        rb = GetComponent<Rigidbody2D>();
        ShotsLeft = Shots;
    }

Sometimes, when not clear errors appear this way, try restart Unity and Visual Studio.