Answers for "have enemy move towards player unity"

C#
9

make an enemy go towards player unity

float speed = whatever;
Vector2 positionToMoveTo = (whatever, whatever);

void Update()
{
  transform.position = Vector2.MoveTowards(transform.position, positionToMoveTo, speed * Time.deltaTime);
}
Posted by: Guest on December-17-2020

Code answers related to "have enemy move towards player unity"

C# Answers by Framework

Browse Popular Code Answers by Language