Hello. I am trying to make a simple script that has an easy function. All I need the script to do is have the enemy follow the player. How would I do this?
var movementSpeed : float = 1.0;
function Update() {
var direction = player.transform.position - transform.position;
transform.position += direction.normalized * movementSpeed * Time.deltaTime;
}
Thanks man.
There is also a follow script mixed in with the default scripts of unity that’s fairly simple to use. (Look up smoothfollow in the asset search, if you imported the default scripts that is.)