- Home /
Question by
Gashinman · Jul 02, 2015 at 08:21 PM ·
c#errorvoididentifier
Please Help
Very confused , I do not understand that for an error Targetting.cs(3,14):error CS1041: Identifier expected. Please tell me , where did I go wrong ?
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Targetting : MonoBehaviour
{
public List<Transform> targets;
// Use this for initialization
void Start ()
{
targets = new List<Transform>();
AddAllEnemies();
}
public void AddAllEnemies()
{
GameObject[] go = GameObject.FindGameObjectsWithTag("Enemy");
foreach(GameObject enemy in go)
AddTarget(enemy.transform);
}
public void AddTarget(Transform enemy)
{
targets.Add(enemy);
}
// Update is called once per frame
void Update () {
}
}
Comment
Answer by gjf · Jul 02, 2015 at 07:46 PM
line #3 (which isn't in the listing because the format is messed up) should read:
using System.Collections.Generic;
looks like you've got a rogue space...
Your answer
Follow this Question
Related Questions
Weird Error c# 1 Answer
Multiple Cars not working 1 Answer
Error CS0023: The '!' operator cannot be applied to operand of type 'void' 1 Answer
Distribute terrain in zones 3 Answers
Unexpected Public variable inside a void 2 Answers