using UnityEngine;
using System.Collections;
public class EnemyAI : MonoBehaviour {
public Transform target;
public int moveSpeed;
public int rotationSpeed;
private Transform myTransform;
void Awake()
{
myTransform = transform;
}
// Use this for initialization
void Start ()
{
GameObject go = GameObject.FindGameObjectWithTag("Player");
target = go.transform;
}
// Update is called once per frame
void Update ()
{
Debug.DrawLine(target.position, myTransform.position, Color.yellow);
//Look at target
}
}
So that is the code (I’m following some youtube videos as i learn), and i can see the piece of code that is drawing a line from the “target” object, to itself. I’m just trying to figure out how this code is assigning “mytransform” to itself.