Unity 2D Roguelike tutorial error

using UnityEngine;

using System.Collections;

public class Enemy : MovingObject {

public int playerDamage;

private Animator animator;

private Transform target;

private bool skipMove;

protected override void Start ()

{

animator = GetComponent ();

target = GameObject.FindGameObjectsWithTag (“Player”).transform;

’System.Array’ does not contain a definition for ‘transform’ accepting a first argument of type ‘System.Array’ could be found (are you missing a using directive or an assembly reference?)

base.Start ();

Do you know which line of code the error is caused at? The error message should say something like
[error] (at Assets/Scripts/FileName.cs:##), where ## is the line number.

that one returns array of objects (even if it finds only 1),

so you might want to take the first item from the array using,

GameObject.FindGameObjectsWithTag ("Player")[0].transform;

or search with this to return single gameobject,

2 Likes

Thank you.