//#pragma strict
var enemies : Transform;
var rand;
function start () {
enemies = GameObject.FindGameObjectsWithTag(“Enemy”);
transform.LookAt(enemies);
}
function Update () {
LookAtRandomEnemy();
}
function LookAtRandomEnemy(){
if (Input.GetButtonDown ("Fire1")){
Random.Range(1, enemies.Length);
}
You can’t do Transform.LookAt(enemies)
because it’s an array, you need to grab one of the transforms out of the array and look at it (you can’t look at all of them at once).
You need to do something with Random.Range, not just state it. Something like
float myFloat;
void Start() {
myFloat = Random.Range(0, enemies.Length);
}
void Update() {
Transform.LookAt(enemies[myFloat]);
}
I suggest you look at the documentation before asking at the unity answers.