Can anyone help me out here (targetting script) the problem is between the \ .... \ (520313)

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

public class Targetting : MonoBehaviour {
public List targets;
public Transform selectedTarget;

private Transform myTransform;

// Use this for initialization
void Start () {
targets = new List ();
AddAllEnemies ();
myTransform = transform;
selectedTarget = null;
}

public void AddAllEnemies()
{
GameObject[ ] go = GameObject.FindGameObjectsWithTag(“Enemy”);
foreach (GameObject enemy in go)
AddTarget (enemy.transform);
}
public void AddTarget(Transform enemy)
{
targets.Add (enemy);
}
private void SortTargetsByDistance()
{
targets.Sort(delegate(Transform t1, Transform t2) {
return Vector3.Distance(t1.position, myTransform.position).CompareTo(Vector3.Distance(t2.position, myTransform.position));
});

}

private void TargetEnemy()
{
if (selectedTarget == null) {
SortTargetsByDistance ();
selectedTarget = targets [0];

}
else
{
int index = targets.IndexOf(selectedTarget);
if(index < targets.Count - 1)
{
index++;
}
else
{
index = 0;
}
DeselectTaget();
selectedTarget = targets[index];

}
\ selectedTarget();
}

private void SelectTarget()
{
selectedTarget.renderer.material.color = Color.red;

PlayerAttack ph = (PlayerAttack)GetComponent (“PlayerAttack”);

ph.target = selectedTarget.gameObject;

}

private void DeselectTaget()
{
selectedTarget.renderer.material.color = Color.blue;
selectedTarget = null;
}

// Update is called once per frame
void Update ()
{
if(Input.GetKeyDown(KeyCode.Tab))
{
TargetEnemy();
}

}
}

You should use the code tags in advanced. Makes it a lot better readable.

Code goes here.

and dont double post

It should be SelectTarget(); instead of selectedTarget(); .

Next time you post an error, it will be much more helpful to use formatting (like making bold the problematic line) and to explain the exact error you encounter.

thanks alot Gord10. and i will remeber first time i posted on this wep-side so im sorry :smile: