Question I need help with Error CS1513 on CS(45,6)

Agent 7

New member
Joined
Mar 8, 2021
Messages
2
Programming Experience
Beginner
Hi guys!! I wanted to ask for help for this game that I'm making. please help me to debug the program thanks the error message at the top
C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameManager : MonoBehaviour {

    private int selectedZombiePosition = 0 ;
    public GameObject selectedZombie;
    public List<GameObject> zombies;
    public Vector3 selectedSize;
    public Vector3 defaultSize;


    // Start is called before the first frame update
    void Start () {
        SelectZombie (selectedZombie);

    }

    // Update is called once per frame
    void Update () {

        if (Input.GetKeyDown ("left")); {
            GetZombieLeft ();
        }
        if (Input.GetKeyDown ("right")); {
            GetZombieRight ();
        }

        if (Input.GetKeyDown ("up"));
    }
    
    void GetZombieLeft() {
        if (selectedZombiePosition == 0) {
            SelectZombie (zombies [3]);
        } else {
            GameObject newZombie = (zombies [selectedZombiePosition - 1]);
            SelectZombie (newZombie);
        }
    }

    void GetZombieRight() {
        if (selectedZombiePosition == 3); {
            SelectZombie (zombies [0]);
        } else {
            SelectZombie (zombies [selectZombiePosition + 1]);
        }
    }

    void SelectZombie(GameObject newZombie) {
        newZombie.transform.localScale = selectedSize;
    }
}
 
Last edited by a moderator:
Not a great way to introduce yourself to the forum. Your code was unformatted and you have provided almost no relevant information. Don't just post an error code and some C# code. Do us the courtesy of making the effort to provide a FULL and CLEAR explanation of the problem. Explain what you're trying to achieve, how you're trying to achieve it and what happens when you try. That includes that actual error message - we shouldn't have to look it up for ourselves when you already know it - and also pointing out where it occurs. You should also be posting only the relevant code. That you have included even the namespace imports means you haven't tried to do that.
 
Not a great way to introduce yourself to the forum. Your code was unformatted and you have provided almost no relevant information. Don't just post an error code and some C# code. Do us the courtesy of making the effort to provide a FULL and CLEAR explanation of the problem. Explain what you're trying to achieve, how you're trying to achieve it and what happens when you try. That includes that actual error message - we shouldn't have to look it up for ourselves when you already know it - and also pointing out where it occurs. You should also be posting only the relevant code. That you have included even the namespace imports means you haven't tried to do that.
Opps sorry! Im new to programming so i cannot really explain clearly the problem. By the way I am trying to run my roller zombie game that I enrolled in Udemy and whenever I try to run the program theres seems to be a curly bracket missing at the end. When I am trying to put a curly braces it keeps on repeating
 
Back
Top Bottom