Okay here is my Script (Using C#)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Targetting : MonoBehaviour {
public List targets;
// Use this for initialization
void Start () {
targets = new List();
AddAllEnemies();
}
public void AddAllEnemies()
{
GameObject go =GameObject.FindGameObjectWithTag(“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 () {
}
}
My Error:
foreach statement cannot operate on variables of type unityengine gameobject because it does not contain a definition for ‘GetEnumerator’ or is not accessible
I’m clueless with Scripting never done it before but I’m in the process of learning so any help would be greatly appreciated, thanks =D
This is also my first of probably many posts on here heehee