Assets/SCRIPT/EnemySpawn.cs(13,32): error CS1061: Type `UnityEngine.GameObject' does not contain a definition for `Length' and no extension method `Length' of type `UnityEngine.GameObject' could be found (are you missing a using directive or an assembly reference?)
This is my script : ( the error is on line 13 )
using UnityEngine;
using System.Collections;
public class EnemySpawn : MonoBehaviour {
public GameObject Enemy;
public int amount;
private Vector3 spawnPoint;
void Update () {
Enemy = GameObject.FindGameObjectWithTag ("Zombies");
amount = Enemy.Length;
}
}
Your problem is this Enemy.Length. You have Enemy defined as a GameObject
public GameObject Enemy;
and GameObject does not have a member Length. From looking at your code, it looks like you want to do something like this
public GameObject[] enemies;
enemies = GameObject.FindGameObjectsWithTag ("Zombies");
amount = enemies.Length;
So your code would actually be this
using UnityEngine;
using System.Collections;
public class EnemySpawn : MonoBehaviour
{
public GameObject[] enemies;
public int amount;
private Vector3 spawnPoint;
void Update ()
{
enemies = GameObject.FindGameObjectsWithTag ("Zombies");
amount = enemies.Length;
}
}