I’m reaaaallllly new to Unity (started getting into it last week) and now I’m stuck as to what is wrong with my code, I know a parsing error means I have a typo or something - but it says it’s on the last line of code? All I need to do is make the enemy look at me and move towards me. I don’t know here’s the code:
using UnityEngine;
using System.Collections;
public class EnemyAI : MonoBehaviour {
public Transform target;
public int moveSpeed;
public int turnSpeed;
// Use this for initialization
void Start () {
target = GameObject.FindGameObjectWithTag("Player").transform;
}
// Update is called once per frame
void Update () {
transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation (target.position - transform.position), turnSpeed * Time.deltaTime);
if(Vector3.Distance(Transform.position, target.position) > 10){
Transform.position += Transform.forward * moveSpeed * Time.deltaTime;
}
}