Parsing Error

So I’m receiving a parsing error. The line that I’m getting at error on is a } and it doesn’t close anything, so I figured that I could just delete it and it was my mistake, but when I did, it just messed up the script, here is the whole script.

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

public class Target : MonoBehaviour {

	public List<Transform> Targets;
	public Transform SelectedTarget;
	private Transform MyTransform;

	// Use this for initialization
	void Start () {
		SelectedTarget = null;
		Targets = new List<Transform>();
		MyTransform = transform;
	public void AddAllEnemys() {
		GameObject[] Go = GameObject.FindGameObjectsWithTag("Enemy");
		foreach(GameObject Enemy in Go)
	public void AddTarget(Transform Enemy){
	private void SortTargetsByDistance(){
		Targets.Sort(delegate(Transform t1, Transform t2) {
			return(Vector.Distance(t1.position, MyTransform.position).Compareto(Vector3.Distance(t2.position, MyTransform.position)));
	private void TargetEnemy()
		if(SlectedTarget == null)
			SelectedTarget = Targets[0];
	// Update is called once per frame
	void Update () {

As a general rule, every open bracket (‘{’) has to have a corresponding closing ‘}’.

You’ll have one opening ‘{’ at the start of your class declaration at the top, and one at the end of your script.

Beyond that, you’ll have one pair for each method, one pair after the if statement, and one pair for the Sort.

Your script doesn’t match that pattern, so you’ll want to clean it up.

If you’re unsure how to do so, I highly recommend finding an introductory C# (or general programming) tutorial online.

I understand that I have to close with “}” but the line that Iam getting an error connects to nothing, if I’m correct the last bracket should close MonoBehaviour.